下载地址:
http://www.oracle.com/cn/products/database/enterprise-edition/overview/index.html#ct02-Download
下面是以手动方式去做好了预安装配置,下面分享下。
1、安装OEL 6.4
安装步骤略,安装后系统情况如下:
[root@khm00 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.4 (Santiago) 内存分配情况: [root@12c ~]# grep MemTotal /proc/meminfo MemTotal: 3515540 kB Swap空间大小,Swap空间我设小了,后面在校验的时候会出现提示。 [root@12c ~]# grep SwapTotal /proc/meminfo SwapTotal: 3063804 kB tmp临时目录大小: [root@12c ~]# df -h /tmp Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_12c-lv_root 50G 4.9G 42G 11% / 磁盘分配信息: [root@12c ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_12c-lv_root 50G 5.1G 42G 11% / tmpfs 1.7G 260K 1.7G 1% /dev/shm /dev/sda1 485M 55M 405M 12% /boot /dev/mapper/vg_12c-lv_home 6.5G 143M 6.1G 3% /home /dev/sr0 3.5G 3.5G 0 100% /media/OL6.4 x86_64 Disc 1 20130225 /dev/sr0 3.5G 3.5G 0 100% /mnt [root@12c ~]# uname -m x86_64
2、下载上传介质
从官方网站下载Oracle12c安装介质,并上传到刚刚安装好的OEL 6.4服务器上。
介质如下:
linuxamd64_12c_database_1of2.zip
linuxamd64_12c_database_2of2.zip
另外还上传一个rlwrap-0.37-1.el6.x86_64.rpm,并安装:
[root@12c ~]# rpm -ivh /install/rlwrap-0.37-1.el6.x86_64.rpm
3、配置/etc/hosts
修改/etc/hosts文件,前两行不懂,添加hostname对应信息。
[root@12c ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.35 12c.luocs.com 12c
4、系统配置
修改/etc/sysctl.conf,添加如下内容:
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
生效:
sysctl -p
修改/etc/security/limits.conf,添加如下内容:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
5、配置YUM源并安装所需包
先将默认的yum配置文件删除或者移动,然后创建一个新的
[root@12c ~]# cd /etc/yum.repos.d [root@12c yum.repos.d]# mkdir bk [root@12c yum.repos.d]# mv public-yum-ol6.repo bk/ [root@12c yum.repos.d]# vi luocs.repo -- 添加如下内容 [Oracle] name=OEL-$releasever - Media baseurl=file:///mnt gpgcheck=0 enabled=1 将光驱挂载上 [root@12c yum.repos.d]# mount /dev/cdrom /mnt mount: block device /dev/sr0 is write-protected, mounting read-only 下面就可以Yum方式安装所需包了 [root@12c yum.repos.d]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh
下面给出官方文档中Linux 6所需要具备的包:
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
加上UnixODBC Driver Manager:
unixODBC-2.2.14-11.el6 (64-bit) or later
unixODBC-devel-2.2.14-11.el6 (64-bit) or later
6、创建用户和组
创建组: [root@12c ~]# /usr/sbin/groupadd -g 54321 oinstall [root@12c ~]# /usr/sbin/groupadd -g 54322 dba [root@12c ~]# /usr/sbin/groupadd -g 54323 oper [root@12c ~]# /usr/sbin/groupadd -g 54324 backupdba [root@12c ~]# /usr/sbin/groupadd -g 54325 dgdba 创建用户: [root@12c ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,backupdba,dgdba oracle [root@12c ~]# passwd oracle
7、确定防火墙和SELinux是禁用的
[root@12c ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 如果防火墙没禁用,那么通过如下方式修改: [root@12c ~]# service iptables stop [root@12c ~]# chkconfig iptables off [root@12c ~]# getenforce Disabled 如果SELinux没有被禁止,那就通过如下方式修改: [root@12c ~]# cat /etc/selinux/config -- 改成SELINUX=disabled # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
8、创建安装目录以及授权
[root@12c ~]# mkdir -p /u01/app/oracle/product/12.1.0/db_1 [root@12c ~]# chown -R oracle:oinstall /u01 [root@12c ~]# chmod -R 775 /u01
9、配置oracle环境变量
[oracle@12c ~]$ vi .bash_profile export PATH export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=12c.luocs.com export ORACLE_UNQNAME=luocs12c export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 export ORACLE_SID=luocs12c export PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib alias sqlplus="rlwrap sqlplus" alias rman="rlwrap rman"
10、解压介质
[root@12c ~]# chown -R oracle.oinstall /install/ [root@12c ~]# su - oracle [oracle@12c ~]$ cd /install/ [oracle@12c install]$ unzip linuxamd64_12c_database_1of2.zip [oracle@12c install]$ unzip linuxamd64_12c_database_2of2.zip 解压之后大小为: [oracle@12c install]$ du -sh database/ 2.6G database/
11、安装
[oracle@12c database]$ pwd /install/database 我打开Xmanager - Passive,设置DISPLAY,调用runInstaller启动OUI [oracle@12c database]$ export DISPLAY=192.168.1.1:0.0 [oracle@12c database]$ ./runInstaller
我首次安装选择了第一项,安装完软件之后接着创建输数据库
注意,Global database name不能以数字开头,需要设置高强度密码,大小写+数字
这里校验的时候提示Swap空间大小不够大,忽略也可完成
[root@12c ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@12c ~]# /u01/app/oracle/product/12.1.0/db_1/root.sh Performing root user operation for Oracle 12c The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/12.1.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed.
等软件安装完毕之后紧接着创建数据库
12、最后
查看进程,发现进程多了很多,新增进程以后慢慢去了解
[oracle@12c ~]$ ps -ef | grep ora_ oracle 6623 1 0 22:21 ? 00:00:00 ora_pmon_luocs12c oracle 6625 1 0 22:21 ? 00:00:00 ora_psp0_luocs12c oracle 6627 1 2 22:21 ? 00:00:14 ora_vktm_luocs12c oracle 6631 1 0 22:21 ? 00:00:00 ora_gen0_luocs12c oracle 6633 1 0 22:21 ? 00:00:00 ora_mman_luocs12c oracle 6637 1 0 22:21 ? 00:00:00 ora_diag_luocs12c oracle 6639 1 0 22:21 ? 00:00:00 ora_dbrm_luocs12c oracle 6641 1 0 22:21 ? 00:00:00 ora_dia0_luocs12c oracle 6643 1 0 22:21 ? 00:00:01 ora_dbw0_luocs12c oracle 6645 1 0 22:21 ? 00:00:00 ora_lgwr_luocs12c oracle 6647 1 0 22:21 ? 00:00:01 ora_ckpt_luocs12c oracle 6649 1 0 22:21 ? 00:00:01 ora_lg00_luocs12c oracle 6651 1 0 22:21 ? 00:00:00 ora_lg01_luocs12c oracle 6653 1 0 22:21 ? 00:00:00 ora_smon_luocs12c oracle 6655 1 0 22:21 ? 00:00:00 ora_reco_luocs12c oracle 6657 1 0 22:21 ? 00:00:00 ora_lreg_luocs12c oracle 6659 1 0 22:21 ? 00:00:02 ora_mmon_luocs12c oracle 6661 1 0 22:21 ? 00:00:01 ora_mmnl_luocs12c oracle 6663 1 0 22:21 ? 00:00:00 ora_d000_luocs12c oracle 6665 1 0 22:21 ? 00:00:00 ora_s000_luocs12c oracle 6677 1 0 22:21 ? 00:00:00 ora_tmon_luocs12c oracle 6679 1 0 22:21 ? 00:00:00 ora_tt00_luocs12c oracle 6681 1 0 22:21 ? 00:00:00 ora_smco_luocs12c oracle 6683 1 0 22:21 ? 00:00:00 ora_aqpc_luocs12c oracle 6687 1 1 22:21 ? 00:00:12 ora_p000_luocs12c oracle 6689 1 2 22:21 ? 00:00:15 ora_p001_luocs12c oracle 6691 1 0 22:21 ? 00:00:01 ora_p002_luocs12c oracle 6693 1 0 22:21 ? 00:00:01 ora_p003_luocs12c oracle 6695 1 0 22:21 ? 00:00:03 ora_p004_luocs12c oracle 6697 1 0 22:22 ? 00:00:01 ora_p005_luocs12c oracle 6699 1 0 22:22 ? 00:00:00 ora_p006_luocs12c oracle 6701 1 0 22:22 ? 00:00:00 ora_p007_luocs12c oracle 6703 1 0 22:22 ? 00:00:00 ora_p008_luocs12c oracle 6705 1 0 22:22 ? 00:00:00 ora_p009_luocs12c oracle 6707 1 0 22:22 ? 00:00:00 ora_p00a_luocs12c oracle 6709 1 0 22:22 ? 00:00:00 ora_p00b_luocs12c oracle 6711 1 0 22:22 ? 00:00:00 ora_p00c_luocs12c oracle 6713 1 0 22:22 ? 00:00:00 ora_p00d_luocs12c oracle 6715 1 0 22:22 ? 00:00:00 ora_p00e_luocs12c oracle 6717 1 0 22:22 ? 00:00:00 ora_p00f_luocs12c oracle 6719 1 0 22:22 ? 00:00:01 ora_w000_luocs12c oracle 6749 1 1 22:22 ? 00:00:09 ora_cjq0_luocs12c oracle 6754 1 0 22:22 ? 00:00:00 ora_p00g_luocs12c oracle 6756 1 0 22:22 ? 00:00:00 ora_p00h_luocs12c oracle 6758 1 0 22:22 ? 00:00:00 ora_qm02_luocs12c oracle 6762 1 0 22:22 ? 00:00:01 ora_q002_luocs12c oracle 6764 1 0 22:22 ? 00:00:00 ora_q003_luocs12c oracle 6788 1 0 22:23 ? 00:00:00 ora_p00i_luocs12c oracle 6790 1 0 22:23 ? 00:00:00 ora_p00j_luocs12c oracle 6792 1 0 22:23 ? 00:00:01 ora_w001_luocs12c oracle 6855 1 0 22:26 ? 00:00:00 ora_p00k_luocs12c oracle 6857 1 0 22:26 ? 00:00:00 ora_p00l_luocs12c oracle 6888 1 0 22:30 ? 00:00:00 ora_w002_luocs12c
如下方式可以访问OEM Database Express 12c:
https://192.168.1.35:5500/em/login
SQL> COL PRODUCT FORMAT A40 SQL> COL VERSION FORMAT A15 SQL> COL STATUS FORMAT A15 SQL> SELECT * FROM PRODUCT_COMPONENT_VERSION; PRODUCT VERSION STATUS ---------------------------------------- --------------- --------------- NLSRTL 12.1.0.1.0 Production Oracle Database 12c Enterprise Edition 12.1.0.1.0 64bit Productio n PL/SQL 12.1.0.1.0 Production TNS for Linux: 12.1.0.1.0 Production SQL> set line 150 pages 9999 SQL> select * from v$version; BANNER CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0 PL/SQL Release 12.1.0.1.0 - Production 0 CORE 12.1.0.1.0 Production 0 TNS for Linux: Version 12.1.0.1.0 - Production 0 NLSRTL Version 12.1.0.1.0 - Production 0 [oracle@12c ~]$ lsnrctl status LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 26-JUN-2013 22:44:44 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production Start Date 26-JUN-2013 22:09:51 Uptime 0 days 0 hr. 34 min. 53 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/12c/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c.luocs.com)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=12c.luocs.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/luocs12c/xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "luocs12c" has 1 instance(s). Instance "luocs12c", status READY, has 1 handler(s) for this service... Service "luocs12cXDB" has 1 instance(s). Instance "luocs12c", status READY, has 1 handler(s) for this service... Service "pdbluocs12c" has 1 instance(s). Instance "luocs12c", status READY, has 1 handler(s) for this service... The command completed successfully Oracle 12C 新特性“可插拔数据库”功能体验 Oracle 12C加入了一个非常有新意的功能“可插拔数据库”特性,实现了数据库(PDB)在“容器”(CDB)上的拔功能,既能提高系统资源的利用率,也简化大面积数据库的管理和迁移工作。下面我们体验一下可插拔数据库的CDB和PDB的操作:基本信息: 根容器(CDB ):CUP 可插拔数据库(PDB):TEA启动根容器: [oracle@eric ~]$ export ORACLE_SID=cup [oracle@eric ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 21 16:00:06 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SQL> startup -----不会直接启动所有可插拔数据库,如需启动所有可插拔数据库,执行命令:alter pluggable database all open ORACLE instance started. Total System Global Area 767557632 bytes Fixed Size 2929112 bytes Variable Size 574623272 bytes Database Buffers 184549376 bytes Redo Buffers 5455872 bytes Database mounted. Database opened. 停止根容器: SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 查看是否创建了CDB,如果有显示名字: SQL> select name,cdb from v$database; NAME CDB --------- --- CUP YES SQL> show parameter service; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string cup 查看容器名字,其中有3个容器:根容器、种子容器和自己创建的容器: SQL> select con_id,name from v$containers; CON_ID NAME ---------- ------------------------------ 1 CDB$ROOT ---根容器 2 PDB$SEED ---种子容器,只可读 3 TEA ---自己创建的可插拔数据库
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbf
SQL> select file_name from cdb_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbf
创建公共用户:
SQL> create user c##eric identified by gao;
User created.
SQL> conn c##eric/gao
ERROR:
ORA-01045: user C##ERIC lacks CREATE SESSION privilege; logon denied ----没有权限,我们可以单独给其赋予权限,也可以给其指定角色。
Warning: You are no longer connected to ORACLE.
SQL> conn / as sysdba
Connected.
SQL> grant dba to c##eric container=all; ---给其DBA角色,角色范围覆盖所有的容器
Grant succeeded.
SQL> conn c##eric/gao
Connected. ---连接成功
切换容器:
首先启动自己创建的容器数据库:
SQL> alter pluggable database tea open; ---首先启动PDB数据库
SQL> alter session set container = tea;
Session altered.
SQL> show con_name ---查看当前所在的容器名
CON_NAME
------------------------------
TEA
关闭可插拔数据库:
SQL> alter pluggable database tea close immediate;
Pluggable database altered.