Pythian Blog: Technical Track

Create 19c Database in Archive Mode Using DBCA Silent

I wanted to export 11.2 database schema and import it into a 19c database; creating the database in archive mode to create a backup of all transactions and allow recovery to any point in time. Since the 19c database did not exist, I needed to create it. I did so by running DBCA in silent mode. I used the following demo and syntax to create the database:
----------------------------------------
 --- DB patch level:
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
 31305087;OCW RELEASE UPDATE 19.8.0.0.0 (31305087)
 31281355;Database Release Update : 19.8.0.0.200714 (31281355)
 
 OPatch succeeded.
 
 ----------------------------------------
 --- Create database in archivelog mode:
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ dbca -silent \
 > -createDatabase \
 > -responseFile NO_VALUE \
 > -templateName General_Purpose.dbc \
 > -sid testdb \
 > -gdbname TESTDB \
 > -characterSet AL32UTF8 \
 > -sysPassword Oracle_4U \
 > -systemPassword Oracle_4U \
 > -createAsContainerDatabase FALSE \
 > -databaseType MULTIPURPOSE \
 > -automaticMemoryManagement FALSE \
 > -totalMemory 2048 \
 > -datafileDestination +DATA \
 > -recoveryAreaDestination +RECO \
 > -redoLogFileSize 50 \
 > -emConfiguration NONE \
 > -sampleSchema FALSE \
 > -enableArchive TRUE \
 > -ignorePreReqs
 Prepare for db operation
 10% complete
 Registering database with Oracle Restart
 14% complete
 Copying database files
 43% complete
 Creating and starting Oracle instance
 45% complete
 49% complete
 53% complete
 56% complete
 62% complete
 Completing Database Creation
 68% complete
 70% complete
 71% complete
 Executing Post Configuration Actions
 100% complete
 Database creation complete. For details check the logfiles at:
  /u01/app/oracle/cfgtoollogs/dbca/TESTDB.
 Database Information:
 Global Database Name:TESTDB
 System Identifier(SID):testdb
 Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/TESTDB/TESTDB0.log" for further details.
 
 ----------------------------------------
 --- Logs for dbca:
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ ls -l /u01/app/oracle/cfgtoollogs/dbca/TESTDB/
 total 21508
 -rw-r-----. 1 oracle oinstall 12131 Nov 20 13:20 cloneDBCreation.log
 -rw-r-----. 1 oracle oinstall 784 Nov 20 13:07 CloneRmanRestore.log
 -rw-r-----. 1 oracle oinstall 1820 Nov 20 13:21 lockAccount.log
 -rw-r-----. 1 oracle oinstall 3578 Nov 20 13:24 postDBCreation.log
 -rw-r-----. 1 oracle oinstall 1436 Nov 20 13:21 postScripts.log
 -rw-r-----. 1 oracle oinstall 0 Nov 20 13:06 rmanUtil
 -rw-r-----. 1 oracle oinstall 18726912 Nov 20 13:07 tempControl.ctl
 -rw-r-----. 1 oracle oinstall 843 Nov 20 13:24 TESTDB0.log
 -rw-r-----. 1 oracle oinstall 843 Nov 6 05:14 TESTDB.log
 -rw-r-----. 1 oracle oinstall 1635418 Nov 6 05:14 trace.log_2020-11-06_04-58-10AM
 -rw-r-----. 1 oracle oinstall 1619098 Nov 20 13:24 trace.log_2020-11-20_01-05-35PM
 
 ----------------------------------------
 --- /etc/oratab is automatically updated:
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ tail /etc/oratab
 #Backup file is /u01/app/oracle/product/19.0.0/dbhome_1/srvm/admin/oratab.bak.ol7-19-lax1.oracle line added by Agent
 +ASM1:/u01/app/19.0.0/grid:N
 hawk1:/u01/app/oracle/product/19.0.0/dbhome_1:N
 testdb:/u01/app/oracle/product/19.0.0/dbhome_1:N
 
 ----------------------------------------
 --- Confirm Archive Mode:
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ . oraenv <<< testdb
 ORACLE_SID = [hawk1] ? The Oracle base remains unchanged with value /u01/app/oracle
 
 [oracle@ol7-19-lax1 ~]$ sqlplus / as sysdba
 
 SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 20 13:25:09 2020
 Version 19.8.0.0.0
 
 Copyright (c) 1982, 2020, Oracle. All rights reserved.
 
 
 Connected to:
 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
 Version 19.8.0.0.0
 
 OL7-19-LAX1:(SYS@TESTDB:PRIMARY> archive log list
 Database log mode Archive Mode
 Automatic archival Enabled
 Archive destination USE_DB_RECOVERY_FILE_DEST
 Oldest online log sequence 31
 Next log sequence to archive 33
 Current log sequence 33
 OL7-19-LAX1:(SYS@TESTDB:PRIMARY> exit
 Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
 Version 19.8.0.0.0
 
 
 ----------------------------------------
 --- Database automatically registered with cluster :
 ----------------------------------------
 
 [oracle@ol7-19-lax1 ~]$ srvctl config database -d testdb
 Database unique name: TESTDB
 Database name: TESTDB
 Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
 Oracle user: oracle
 Spfile: +DATA/TESTDB/PARAMETERFILE/spfile.315.1056983141
 Password file:
 Domain:
 Start options: open
 Stop options: immediate
 Database role: PRIMARY
 Management policy: AUTOMATIC
 Server pools:
 Disk Groups: DATA,RECO
 Mount point paths:
 Services:
 Type: SINGLE
 OSDBA group: dba
 OSOPER group: oper
 Database instance: testdb
 Configured nodes: ol7-19-lax1
 CSS critical: no
 CPU count: 0
 Memory target: 0
 Maximum memory: 0
 Default network number for database services:
 Database is administrator managed
 [oracle@ol7-19-lax1 ~]$
 
 ------------------------------
 --- Delete database:
 ------------------------------
 
 [oracle@ol7-19-lax1 ~]$ dbca -silent -deleteDatabase -sourceDB testdb
 Enter SYS user password:
 
 [WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
 Prepare for db operation
 32% complete
 Connecting to database
 35% complete
 39% complete
 42% complete
 45% complete
 48% complete
 52% complete
 65% complete
 Updating network configuration files
 68% complete
 Deleting instance and datafiles
 84% complete
 100% complete
 Database deletion completed.
 Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/TESTDB/TESTDB1.log" for further details.
 [oracle@ol7-19-lax1 ~]$
As you can see, using DBCA to create your database is useful and convenient. If you have any questions about how this might apply to your specific situation, please feel free to leave a comment.

No Comments Yet

Let us know what you think

Subscribe by email