Silent Installation静默安装11gR2 DB SERVER单机并手动建库步骤

静默安装11gR2 DB SERVER单机并手动建库步骤

静默安装是在我们无法使用OUI图形界面安装ORACLE DB软件,亦或者我们需要大规模部署该软件时采用的方法。
静默安装不要求启动图形界面,仅仅使用命令行即可实施。

具体在11gR2单机以silent静默方式安装时,可以省略使用response file,步骤如下:

1. 解压安装包,如果你是在Linux上且安装目前最新的Patchset 11.2.0.3(推荐)的话,首先解压介质安装包

如果在AIX上可能还需要执行必要的rootpre.sh

 

 

2. 创建必要的目录,以及Oracle用户的ulimit限制和kernel parameters

[root@mlab2 grid]# mkdir /u01

[root@mlab2 grid]# chown oracle:oinstall /u01
[root@mlab2 grid]# su – oracle

 

 

3. 正式使用runInstaller -silent 静默方式安装
$ ./runInstaller -silent -debug -force \
FROM_LOCATION=/home/oracle/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oracle/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11201/db_1 \
ORACLE_HOME_NAME=”OraDb11g_Home9″ \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=dba \
DECLINE_SECURITY_UPDATES=true

 

 

4.
切换到root用户执行必要的脚本

[oracle@mlab2 bin]$ su – root
Password:
[root@mlab2 ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@mlab2 ~]# /u01/app/oracle/product/11201/db_1/root.sh
Check /u01/app/oracle/product/11201/db_1/install/root_mlab2.oracle.com_2009-11-23_20-26-32.log for the output of root script

 

 

 

5.
设置必要的环境变量

[oracle@mlab2 ~]$ cat db2.sh

 

export ORACLE_SID=CRMV
export ORACLE_HOME=/u01/app/oracle/product/11201/db_1
export ORACLE_BASE=/u01/app/oracle
export PATH=$ORACLE_HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:$ORACLE_HOME/OPatch:/opt/oracle.SupportTools

 

6.

创建必要的目录

[root@mlab2 ~]# mkdir /oradata/
[root@mlab2 ~]# chown oracle:oinstall /oradata

 

[oracle@mlab2 ~]$ mkdir -p /oradata/CRMV/controlfile
[oracle@mlab2 dbs]$ mkdir /oradata/CRMV/logfile
[oracle@mlab2 dbs]$ mkdir /oradata/CRMV/datafile

 

 

7.

创建init.ora PFILE初始化参数文件
[oracle@mlab2 ~]$ source db2.sh
[oracle@mlab2 ~]$ cd $ORACLE_HOME
[oracle@mlab2 db_1]$ cd dbs
[oracle@mlab2 dbs]$ cat init
initCRMV.ora init.ora

 

[oracle@mlab2 dbs]$ cat initCRMV.ora
db_name=CRMV
sga_target=1200M
control_files=(‘/oradata/CRMV/controlfile/control01.dbf’,’/oradata/CRMV/controlfile/control02.dbf’)
undo_management=AUTO
undo_tablespace=UNDOTBS

 

8.创建密码文件

[oracle@mlab2 dbs]$ orapwd file=orapwCRMV entries=10 password=oracle
[oracle@mlab2 dbs]$ ls -l orapwCRMV
-rw-r—– 1 oracle oinstall 2560 Nov 23 20:58 orapwCRMV

 

 

9.
正式手动建库

CREATE DATABASE CRMV
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 (‘/oradata/CRMV/logfile/redo01.log’) SIZE 256M,
GROUP 2 (‘/oradata/CRMV/logfile/redo02.log’) SIZE 256M,
GROUP 3 (‘/oradata/CRMV/logfile/redo03.log’) SIZE 256M
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXLOGHISTORY 10000
MAXDATAFILES 3000
MAXINSTANCES 10
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET UTF8
DATAFILE ‘/oradata/CRMV/datafile/system01.dbf’ SIZE 825M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE ‘/oradata/CRMV/datafile/sysaux01.dbf’ SIZE 825M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/oradata/CRMV/datafile/temp01.dbf’
SIZE 200M REUSE
UNDO TABLESPACE undotbs
DATAFILE ‘/oradata/CRMV/datafile/undotbs01.dbf’
SIZE 600M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

 

此步骤也可以参考链接:http://docs.oracle.com/cd/B19306_01/server.102/b14231/create.htm#g1034097

 

 

10.
创建非必要的表空间例如USERS,以及应用表空间或索引表空间
SQL> alter system set db_create_file_dest=’/oradata/CRMV’;

System altered.
CONNECT SYS/password AS SYSDBA
— create a user tablespace to be assigned as the default tablespace for users
CREATE TABLESPACE users LOGGING
DATAFILE SIZE 525M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
— create a tablespace for indexes, separate from user tablespace
CREATE TABLESPACE indx LOGGING
DATAFILE SIZE 325M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;

SQL>
SQL> alter database default tablespace users;

Database altered.

SQL> alter database default temporary tablespace tempts1;
alter database default temporary tablespace tempts1
*
ERROR at line 1:
ORA-12907: tablespace TEMPTS1 is already the default temporary tablespace

 

 

 

11.
执行catalog.sql和catproc.sql 2个必要的字典脚本

CONNECT SYS/password AS SYSDBA
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
EXIT

1* select comp_name,version from dba_server_registry
SQL> /

COMP_NAME VERSION
—————————————- ——————————
Oracle Database Catalog Views 11.2.0.3.0
Oracle Database Packages and Types 11.2.0.3.0

2 rows selected.

其他一些有必要执行的脚本

@?/rdbms/admin/catblock.sql
@?/rdbms/admin/dbmspool.sql

conn system/oracle

@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql

 

 

 

12. 设置必要的参数,并打开 日志归档

SQL> create spfile from pfile;

File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1252663296 bytes
Fixed Size 2227944 bytes
Variable Size 335544600 bytes
Database Buffers 905969664 bytes
Redo Buffers 8921088 bytes
Database mounted.
SQL> alter system set deferred_segment_creation=false;

System altered.
SQL> alter database archivelog ;

Database altered.
SQL> alter database open;

Database altered.
SQL> alter system archive log current;

System altered.

SQL> /

System altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/product/11201/db_1/dbs/arch
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
更多11g 参数推荐可以参考 https://www.askmac.cn/archives/11gr2-features-disable.html

 

 

13. 如果需要重命名DB NAME,则可以运行如下命令

SQL> alter database rename global_name to LIUXIANGBING;

Database altered.

SQL> select * from global_name;

GLOBAL_NAME
——————————————————————————–
LIUXIANGBING

 

14. 配置LISTENER、SQLNET.ORA等网络参数


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *