创建模板
- 使用新装好的 Oracle 数据库,创建模板 - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13- [oracle@dbs ~]$ dbca -silent -createCloneTemplate -sourceSID orcl -templateName orcl 
 Gathering information from the source database
 4% complete
 8% complete
 13% complete
 17% complete
 22% complete
 Backup datafiles
 28% complete
 88% complete
 Creating template file
 100% complete
 Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/silent.log_2021-06-04_01-20-40-PM" for further details.
- 模板文件目录查看 - 1 
 2- [oracle@dbs ~]$ ls /u01/app/oracle/product/11.2.0/assistants/dbca/templates/ 
 Data_Warehouse.dbc example01.dfb example.dmp General_Purpose.dbc New_Database.dbt orcl.ctl orcl.dbc orcl.dfb Seed_Database.ctl Seed_Database.dfb
使用模板创建数据库
- 使用上面创建的 orcl 模板创建 ahwms 新实例 - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34- dbca -silent -createDatabase \ 
 -templateName $ORACLE_HOME/assistants/dbca/templates/orcl.dbc \
 -gdbName ahwms \
 -sid ahwms \
 -sysPassword "xxxxxx" \
 -systemPassword "xxxxx" \
 -datafileDestination $ORACLE_BASE/oradata \
 -recoveryAreaDestination $ORACLE_BASE/flash_recovery_area \
 -characterSet ZHS16GBK
 # 输出如下
 Copying database files
 1% complete
 3% complete
 11% complete
 18% complete
 26% 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 "/u01/app/oracle/cfgtoollogs/dbca/ahwms/ahwms.log" for further details.
- 查看监听 - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31- [oracle@dbs database]$ lsnrctl status 
 LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-JUN-2021 13:31:09
 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 11.2.0.4.0 - Production
 Start Date 04-JUN-2021 13:15:36
 Uptime 0 days 0 hr. 15 min. 32 sec
 Trace Level off
 Security ON: Local OS Authentication
 SNMP OFF
 Listener Parameter File /u01/app/oracle/product/11.2.0/network/admin/listener.ora
 Listener Log File /u01/app/oracle/diag/tnslsnr/dbs/listener/alert/log.xml
 Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbs)(PORT=1521)))
 Services Summary...
 Service "ahwms" has 1 instance(s).
 Instance "ahwms", status READY, has 1 handler(s) for this service...
 Service "ahwmsXDB" has 1 instance(s).
 Instance "ahwms", status READY, has 1 handler(s) for this service...
 Service "orcl" has 1 instance(s).
 Instance "orcl", status READY, has 1 handler(s) for this service...
 Service "orclXDB" has 1 instance(s).
 Instance "orcl", status READY, has 1 handler(s) for this service...
 The command completed successfully
- 测试访问数据库 - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59- # 先访问默认的 orcl 实例 
 [oracle@dbs database]$ echo $ORACLE_SID
 orcl
 [oracle@dbs database]$ sqlplus / as sysdba
 SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 4 13:32:26 2021
 Copyright (c) 1982, 2013, Oracle. All rights reserved.
 Connected to:
 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options
 SQL> show parameter name;
 NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 cell_offloadgroup_name string
 db_file_name_convert string
 db_name string orcl
 db_unique_name string orcl
 global_names boolean FALSE
 instance_name string orcl
 lock_name_space string
 log_file_name_convert string
 processor_group_name string
 service_names string orcl
 SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options
 # 修改 SID 为 ahwms
 [oracle@dbs database]$ export ORACLE_SID=ahwms
 [oracle@dbs database]$ sqlplus / as sysdba
 SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 4 13:32:57 2021
 Copyright (c) 1982, 2013, Oracle. All rights reserved.
 Connected to:
 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options
 SQL> show parameter name;
 NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 cell_offloadgroup_name string
 db_file_name_convert string
 db_name string ahwms
 db_unique_name string ahwms
 global_names boolean FALSE
 instance_name string ahwms
 lock_name_space string
 log_file_name_convert string
 processor_group_name string
 service_names string ahwms
 SQL>
 
		