Oracle 静默安装 oracle 12c

时间:2022-05-26 15:41:52

[oracle@local12cdg app]$ id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
[oracle@local12cdg app]$ mkdir -p /u02/app/oracle/product/12.1.0/dbhome_1
[oracle@local12cdg app]$ mkdir -p /u02/app/oracle/oraInventory
[root@local12cdg oracle]# chmod -R 755 /u02/app/oracle/
[root@local12cdg response]# cp *.rsp /u02/app/
[root@local12cdg response]# cd /u02/app/
[root@local12cdg app]# chmod 700 *.rsp
[root@local12cdg app]# ll
total 100
-rwx------ 1 oracle oinstall 58021 May 26 00:04 dbca.rsp
-rwx------ 1 oracle oinstall 26690 May 26 00:04 db_install.rsp
-rwx------ 1 oracle oinstall 6038 May 26 00:04 netca.rsp
drwxrwxr-x 2 oracle oinstall 4096 May 25 02:34 oracle
安装oracle软件
----------
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=local12cdg
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.BACKUPDBA_GROUP=dba
oracle.install.db.DGDBA_GROUP=dba
oracle.install.db.KMDBA_GROUP=dba
#MYORACLESUPPORT_USERNAME=yhq1314@oracle.com
#MYORACLESUPPORT_PASSWORD=yhq1314
#SECURITY_UPDATES_VIA_MYORACLESUPPORT=0
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES
#AUTOUPDATES_MYORACLESUPPORT_USERNAME=yhq1314@oracle.com
#AUTOUPDATES_MYORACLESUPPORT_PASSWORD=yhq1314
--------

/u01/oracleware/database/runInstaller -silent -noconfig -responseFile /u02/app/db_install.rsp
-silent 表示静默安装
-noconfig 表示只安装软件
-responseFile 指定响应文件
监控安装的过程
tail -f /u02/app/oracle/oraInventory/logs/installActions2015-05-26_12-42-44AM.log
[oracle@local12cdg app]$ [FATAL] PRVF-0002 : Could not retrieve local nodename
[oracle@local12cdg app]$ hostname
local12cdg
[oracle@local12cdg app]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.189 oracle12cdg

[root@local12cdg ~]# tail -f /u02/app/oracle/oraInventory/logs/installActions2015-05-26_12-42-44AM.log
INFO: Installation in progress
INFO: Extracting files to '/u02/app/oracle/product/12.1.0/dbhome_1'.
INFO: Extracting files to '/u02/app/oracle/product/12.1.0/dbhome_1'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_dirs.lst'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_filemap.jar'.
INFO: Performing fastcopy operations based on the information in the file 'racfiles.jar'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_exp_1.xml'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_1.xml'.
INFO: Performing fastcopy operations based on the information in the file 'setperms1.sh'.
INFO: Number of threads for fast copy :1

[oracle@local12cdg ~]$ /u01/oracleware/database/runInstaller -silent -noconfig -responseFile /u02/app/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB. Actual 63526 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-05-26_12-42-44AM. Please wait ...[oracle@local12cdg ~]$ [WARNING] [INS-13001] Environment does not meet minimum requirements.
CAUSE: Minimum requirements were not met for this environment
ACTION: Either check the logs for more information or check the supported configurations for this product.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/u02/app/oracle/oraInventory/logs/installActions2015-05-26_12-42-44AM.log
The installation of Oracle Database 12c was successful.
Please check '/u02/app/oracle/oraInventory/logs/silentInstall2015-05-26_12-42-44AM.log' for more details.

As a root user, execute the following script(s):
1. /u02/app/oracle/oraInventory/orainstRoot.sh
2. /u02/app/oracle/product/12.1.0/dbhome_1/root.sh

Successfully Setup Software.
As install user, execute the following script to complete the configuration.
1. /u02/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file>

Note:
1. This script must be run on the same host from where installer was run.
2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation).

[root@local12cdg ~]# /u02/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u02/app/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u02/app/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@local12cdg ~]# /u02/app/oracle/product/12.1.0/dbhome_1/root.sh
Check /u02/app/oracle/product/12.1.0/dbhome_1/install/root_local12cdg_2015-05-26_00-48-46.log for the output of root script

配置监听
vi /u02/app/netca.rsp
/u02/app/oracle/product/12.1.0/dbhome_1/bin/netca -silent -responsefile /u02/app/netca.rsp
[oracle@local12cdg ~]$ /u02/app/oracle/product/12.1.0/dbhome_1/bin/netca -silent -responsefile /u02/app/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u02/app/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u02/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@local12cdg ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 26-MAY-2015 00:59:53

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-MAY-2015 00:59:28
Uptime 0 days 0 hr. 0 min. 25 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u02/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u02/app/oracle/diag/tnslsnr/local12cdg/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=local12cdg)(PORT=1521)))
The listener supports no services
The command completed successfully
创建数据库
[CREATEDATABASE]
GDBNAME = "local12cdg.oracle.com"
SID = "local12cdg"
CREATEASCONTAINERDATABASE =true
NUMBEROFPDBS =1
PDBNAME =smartfoundry
SYSPASSWORD = "yhq1314"
SYSTEMPASSWORD = "yhq1314"
EMCONFIGURATION = "NONE"
SYSMANPASSWORD = "yhq1314"
DBSNMPPASSWORD = "yhq1314"
#HOSTUSERNAME =rac1
#HOSTUSERPASSWORD=rac1
DATAFILEDESTINATION =$ORACLE_BASE/oradata
RECOVERYAREADESTINATION=$ORACLE_BASE/flash_recovery_area
STORAGETYPE=FS
CHARACTERSET = "AL32UTF8"
NATIONALCHARACTERSET= "UTF8"

/u02/app/oracle/product/12.1.0/dbhome_1/bin/dbca -silent -responsefile /u02/app/dbca.rsp
[oracle@local12cdg app]$ /u02/app/oracle/product/12.1.0/dbhome_1/bin/dbca -silent -responsefile /u02/app/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
33% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u02/app/oracle/cfgtoollogs/dbca/local12cdg/local12c.log" for further details.
[oracle@local12cdg app]$ sqlplus /nolog

SQL*Plus: Release 12.1.0.1.0 Production on Tue May 26 01:29:33 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> conn /as sysdba
Connected.
SQL> show user;
USER is "SYS"
SQL>
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u02/app/oracle/oradata/local12cdg/system01.dbf
/u02/app/oracle/oradata/local12cdg/sysaux01.dbf
/u02/app/oracle/oradata/local12cdg/undotbs01.dbf
/u02/app/oracle/oradata/local12cdg/users01.dbf

SQL> select name,value from v$parameter where name='spfile';

NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
spfile
/u02/app/oracle/product/12.1.0/dbhome_1/dbs/spfilelocal12cdg.ora

SQL> select name,value from v$parameter where name='control_files';

NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
control_files
/u02/app/oracle/oradata/local12cdg/control01.ctl, /u02/app/oracle/fast_recovery_
area/local12cdg/control02.ctl

SQL> show pdbs;
SQL> show con_name;

CON_NAME
------------------------------
Non Consolidated
SQL> create user c##t2 identified by t2;
create user c##t2 identified by t2
*
ERROR at line 1:
ORA-65094: invalid local user or role name

SQL> show user;
USER is "SYS"
SQL> select count(1) from session_privs;

COUNT(1)
----------
233