---1、安装
oracle 的前期准备
oracle 用户 .bash_profile 文件内容
umask 022
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/u01/app
ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1
ORACLE_SID=ora11g
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/u01/app
ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1
ORACLE_SID=ora11g
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
./runInstaller -silent -noconfig -responseFile /u01/app/db_install.rsp
在执行的过程中出现下面的问题:
-----------------------------
[oracle@localhost database]$ ./runInstaller -silent -force -noconfig -responseFile /home/oracle/db_install.rsp
Starting Oracle Universal Installer...
-----------------------------
[oracle@localhost database]$ ./runInstaller -silent -force -noconfig -responseFile /home/oracle/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 80 MB. Actual 127047 MB Passed
Checking swap space: must be greater than 150 MB. Actual 4000 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-11-30_08-48-47PM. Please wait ...[oracle@localhost database]$ [SEVERE] - Email Address Not Specified
Checking swap space: must be greater than 150 MB. Actual 4000 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-11-30_08-48-47PM. Please wait ...[oracle@localhost database]$ [SEVERE] - Email Address Not Specified
处理方法配置下面的参数在responsefile 文件中:
DECLINE_SECURITY_UPDATES=true
上面的操作只安装了oracle 11g R2 数据库 软件。 下面手工创建数据库。
--------------------
3、在nomount 状态下创建数据库。所以需要创建实例启动用的参数文件。在程序默认的参数文件里修改即可:重命名规则 initSID.ora
initora11g.ora
db_name='ora11g' --修改
#memory_target=500m --注释掉
sga_target=200m --添加
pga_aggregate_target=60m --添加
processes = 150
audit_file_dest='/u01/app/admin/ora11g/adump' --建立目录
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/flash_recovery_area' --建立目录
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app' ---修改
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
#memory_target=500m --注释掉
sga_target=200m --添加
pga_aggregate_target=60m --添加
processes = 150
audit_file_dest='/u01/app/admin/ora11g/adump' --建立目录
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/flash_recovery_area' --建立目录
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app' ---修改
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
创建相应的目录
mkdir -p /u01/app/admin/ora11g/adump
mkdir -p /u01/app/admin/ora11g/dpdump
mkdir -p /u01/app/flash_recovery_area
mkdir -p /u01/app/admin/ora11g/dpdump
mkdir -p /u01/app/flash_recovery_area
---------------------------------------------------------------------------
[oracle@haozg dbs]$ orapwd file=orapwora11g password=oracle
[oracle@haozg dbs]$ ls
hc_ora11g.dat initora11g.ora lkORA11G ora_control1 ora_control2 orapwora11g peshm_ora11g_0
[oracle@haozg dbs]$ ls
hc_ora11g.dat initora11g.ora lkORA11G ora_control1 ora_control2 orapwora11g peshm_ora11g_0
5、启动实例创建数据库
----------------------------------- 建库脚本-----------------
startup nomount pfile="/u01/app/product/11.2.0.1/db1/dbs/initora11g.ora";
CREATE DATABASE "ora11g"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/app/oradata/system01.dbf' SIZE 1024M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oradata/sysaux01.dbf' SIZE 500M REUSE
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oradata/temp01.dbf' SIZE 20M REUSE
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oradata/undo01.dbf' SIZE 300M REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/u01/app/oradata/log01.dbf') SIZE 50M,
GROUP 2 ('/u01/app/oradata/log02.dbf') SIZE 50M,
GROUP 3 ('/u01/app/oradata/log03.dbf') SIZE 50M;
CREATE DATABASE "ora11g"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/app/oradata/system01.dbf' SIZE 1024M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oradata/sysaux01.dbf' SIZE 500M REUSE
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oradata/temp01.dbf' SIZE 20M REUSE
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oradata/undo01.dbf' SIZE 300M REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/u01/app/oradata/log01.dbf') SIZE 50M,
GROUP 2 ('/u01/app/oradata/log02.dbf') SIZE 50M,
GROUP 3 ('/u01/app/oradata/log03.dbf') SIZE 50M;
创建USERS表空间
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/u01/app/oradata/user01.dbf' SIZE 1000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
------------------------------------------
SQL> create spfile from pfile;
File created.
------------------------------------------
使用sys用户编译以下脚本
sqlplus / as sysdba
SQL> show user;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catalog.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catblock.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catproc.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catoctk.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/owminst.plb;
sqlplus / as sysdba
SQL> show user;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catalog.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catblock.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catproc.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catoctk.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/owminst.plb;
使用system用户编译
@/u01/app/product/11.2.0.1/db1/sqlplus/admin/pupbld.sql;
@/u01/app/product/11.2.0.1/db1/sqlplus/admin/help/hlpbld.sql helpus.sql;
@/u01/app/product/11.2.0.1/db1/sqlplus/admin/pupbld.sql;
@/u01/app/product/11.2.0.1/db1/sqlplus/admin/help/hlpbld.sql helpus.sql;
使用sys用户编译
@/u01/app/product/11.2.0.1/db1/javavm/install/initjvm.sql;
@/u01/app/product/11.2.0.1/db1/xdk/admin/initxml.sql;
@/u01/app/product/11.2.0.1/db1/xdk/admin/xmlja.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catjava.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catexf.sql;
@/u01/app/product/11.2.0.1/db1/javavm/install/initjvm.sql;
@/u01/app/product/11.2.0.1/db1/xdk/admin/initxml.sql;
@/u01/app/product/11.2.0.1/db1/xdk/admin/xmlja.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catjava.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catexf.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catqm.sql change_on_install SYSAUX TEMP YES;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catxdbj.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catrul.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catxdbj.sql;
@/u01/app/product/11.2.0.1/db1/rdbms/admin/catrul.sql;
spool /oracle/admin/edidb/scripts/ordinst.log append
@/u01/app/product/11.2.0.1/db1/ord/admin/ordinst.sql SYSAUX SYSAUX;
spool off
spool /u01/app/admin/ora11g/scripts/interMedia.log append
@/u01/app/product/11.2.0.1/db1/ord/im/admin/iminst.sql;
spool off
@/u01/app/product/11.2.0.1/db1/ord/im/admin/iminst.sql;
spool off
set echo on
spool /oracle/admin/edidb/scripts/lockAccount.log append
BEGIN
FOR item IN ( SELECT USERNAME FROM DBA_USERS WHERE ACCOUNT_STATUS IN ('OPEN', 'LOCKED', 'EXPIRED') AND USERNAME NOT IN (
'SYS','SYSTEM') )
LOOP
dbms_output.put_line('Locking and Expiring: ' || item.USERNAME);
execute immediate 'alter user ' ||
sys.dbms_assert.enquote_name(
sys.dbms_assert.schema_name(
item.USERNAME),false) || ' password expire account lock' ;
END LOOP;
END;
/
spool off
spool /oracle/admin/edidb/scripts/lockAccount.log append
BEGIN
FOR item IN ( SELECT USERNAME FROM DBA_USERS WHERE ACCOUNT_STATUS IN ('OPEN', 'LOCKED', 'EXPIRED') AND USERNAME NOT IN (
'SYS','SYSTEM') )
LOOP
dbms_output.put_line('Locking and Expiring: ' || item.USERNAME);
execute immediate 'alter user ' ||
sys.dbms_assert.enquote_name(
sys.dbms_assert.schema_name(
item.USERNAME),false) || ' password expire account lock' ;
END LOOP;
END;
/
spool off
--------静默安装是响应db_insatll.rsp文件的内容需要修改的地方
1、oracle.install.option=INSTALL_DB_SWONLY
2、ORACLE_HOSTNAME=haozg
3、UNIX_GROUP_NAME=oinstall
4、INVENTORY_LOCATION=/u01/app/oraInventory
5、ORACLE_HOME=/u01/app/product/11.2.0.1/db1
6、ORACLE_BASE=/u01/app
7、oracle.install.db.DBA_GROUP=dba
8、oracle.install.db.OPER_GROUP=oinstall
9、DECLINE_SECURITY_UPDATES=true