今天接到通知,下周去一个新客户那边部署新环境,问题是时间还很紧,让下周一就去,时间紧还不是大问题,问题是产品的中间件Weblogic跟数据库Oracle我都好久没玩
今天接到通知,下周去一个新客户那边部署新环境,问题是时间还很紧,让下周一就去,时间紧还不是大问题,问题是产品的中间件Weblogic跟数据库Oracle我都好久没玩了,没得办法,只能提前演练一下了,为了下次找起来更加方便,就把过程整理到本博客上面来,也可以方便其他童鞋的查询吧。
谁要是跟我纠结时间这么紧,哪来的时间写博客的,我跟谁急哦!方便自己,也方便大家嘛!
华丽分割线
一.查看系统配置信息
[root@web-db ~]# hostname --fqdn //查看主机名 web-db [root@web-db ~]# ifconfig eth0 //查看本机IP地址 eth0 Link encap:Ethernet HWaddr 06:F1:96:00:00:C0 inet addr:192.168.153.153 Bcast:192.168.153.255 Mask:255.255.255.0 inet6 addr: fe80::4f1:96ff:fe00:c0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1706513 errors:0 dropped:0 overruns:0 frame:0 TX packets:877952 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2565533900 (2.3 GiB) TX bytes:59768622 (56.9 MiB) [root@web-db ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.153.153 web-db [root@web-db ~]# cat /etc/redhat-release //查看RHEL发行版本 Red Hat Enterprise Linux Server release 6.3 (Santiago) [root@web-db ~]# uname -m //查看本机CPU架构 x86_64 [root@web-db ~]# free -m //查看内存跟交换分区信息 total used free shared buffers cached Mem: 7870 2876 4993 0 12 2609 -/+ buffers/cache: 254 7616 Swap: 5760 0 5760 [root@web-db ~]# df -H //查看分区挂载信息 Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 9.1G 3.6G 5.1G 41% / tmpfs 4.2G 0 4.2G 0% /dev/shm /dev/vda1 508M 33M 449M 7% /boot /dev/vdb5 30G 181M 28G 1% /u01当然,有朋友会问:你用的是物理机还是虚拟机?
我这么有钱,想想就知道我用的是什么了,是不是?
[root@web-db ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 1 CPU socket(s): 8 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 13 Stepping: 3 CPU MHz: 2393.998 BogoMIPS: 4787.99 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 4096K NUMA node0 CPU(s): 0-7咦? 怎么不是物理机,我说我什么时候这么有钱的呢?用的还是KVM虚拟机。
呵呵,开个玩笑,我们继续技术交流,禁止鄙视使用虚拟机的屌丝!
二.配置系统YUM源,安装依赖包
[root@web-db ~]# mount /dev/sr0 /media/ mount: block device /dev/sr0 is write-protected, mounting read-only [root@web-db ~]# cat /etc/yum.repos.d/rhel-source.repo [rhel6u3-core] name=rhel6u3-core baseurl=file:///media enabled=1 gpgcheck=0[root@web-db ~]# yum clean all Loaded plugins: product-id, subscription-manager Updating certificate-based repositories. Unable to read consumer identity Cleaning repos: rhel6u3-core Cleaning up Everything[root@web-db ~]# cat package.list //需要安装的依赖包信息列表 binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686[root@web-db ~]# yum install `cat package.list` -y //安装依赖包三.修改内核参数
四. 创建Oracle用户以及相关权限修改
1. 创建oracle 用户组跟用户
[root@web-db ~]# groupadd oinstall [root@web-db ~]# groupadd dba [root@web-db ~]# useradd -g oinstall -G dba -m oracle [root@web-db ~]# echo oracle |passwd --stdin oracle //创建密码 Changing password for user oracle. passwd: all authentication tokens updated successfully.2. 修改限制
[root@web-db ~]# cp /etc/security/limits.conf /etc/security/limits.conf.20131016.bak ##=============Setting For Oracle 11G R2=============## oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 [root@web-db ~]# cat /etc/pam.d/login ##======Setting For Oracle 11G R2========## session required pam_limits.so [root@web-db ~]# cat /etc/profile ##===Setting For Oracle 11G R2=====## if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi [root@web-db ~]# source /etc/profile
InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor