Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the ADG of Oracle 12c CDB

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to understand the ADG of Oracle 12c CDB. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Experimental environment

OS:oracle linux 6.6

DB:oracle 12.1.0.1

Main library: chicago, pdb1, pdb2

Library: boston, pdb1, pdb2

Main library operation

0. Verify that the tnsping can be accessed between the primary and standby libraries. If the ping can be reached, but the tnsping is not available, it is very likely that the firewall is not turned off.

[root@snow ~] # service iptables stop

1. Planning of main database files, control files and log files

[oracle@snow ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Fri May 1 17:47:28 2015

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SYS@chicago > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 READ WRITE NO

SYS@chicago >

Select name from v$datafile

Union

Select name from v$controlfile

Union

Select member from v$logfile

Union

Select name from v$tempfile

Union

Select value from v$parameter where name='spfile'

NAME

/ home/oracle/dbfile/chicago/control01.ctl

/ home/oracle/dbfile/chicago/control02.ctl

/ home/oracle/dbfile/chicago/pdb1/SAMPLE_SCHEMA_users01.dbf

/ home/oracle/dbfile/chicago/pdb1/example01.dbf

/ home/oracle/dbfile/chicago/pdb1/pdb1_temp01.dbf

/ home/oracle/dbfile/chicago/pdb1/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdb1/system01.dbf

/ home/oracle/dbfile/chicago/pdbseed/pdbseed_temp01.dbf

/ home/oracle/dbfile/chicago/pdbseed/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdbseed/system01.dbf

/ home/oracle/dbfile/chicago/redo01.log

NAME

/ home/oracle/dbfile/chicago/redo02.log

/ home/oracle/dbfile/chicago/redo03.log

/ home/oracle/dbfile/chicago/sysaux01.dbf

/ home/oracle/dbfile/chicago/system01.dbf

/ home/oracle/dbfile/chicago/temp01.dbf

/ home/oracle/dbfile/chicago/undotbs01.dbf

/ home/oracle/dbfile/chicago/users01.dbf

/ u01/app/oracle/product/12.1.0.1/db_1/dbs/spfilechicago.ora

19 rows selected.

two。 There are 3 groups of redo in the main library. Create 4 groups of standby logfile group for this purpose.

SYS@chicago > select group#,bytes/1024/1024 from v$log

GROUP# BYTES/1024/1024

--

1 50

2 50

3 50

SYS@chicago >

Alter database add standby logfile group 4 ('/ home/oracle/dbfile/chicago/redo04.log') size 50m

Alter database add standby logfile group 5 ('/ home/oracle/dbfile/chicago/redo05.log') size 50m

Alter database add standby logfile group 6 ('/ home/oracle/dbfile/chicago/redo06.log') size 50m

Alter database add standby logfile group 7 ('/ home/oracle/dbfile/chicago/redo07.log') size 50m

3. The main library sets up foece logging

SYS@chicago > alter database force logging

SYS@chicago > shutdown immediate

4. The main library creates pfile

SYS@chicago > create pfile from spfile

SYS@chicago > exit

5. Add content to the pfile of the main library

[oracle@snow ~] $cd $ORACLE_HOME/dbs

[oracle@snow dbs] $vi initchicago.ora

* .audit_file_dest='/u01/app/oracle/admin/chicago/adump'

* .audit_trail='db'

* .compatible='12.1.0.0.0'

* .control_files='/home/oracle/dbfile/chicago/control01.ctl','/home/oracle/dbfile/chicago/control02.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_name='chicago'

* .diagnostic_dest='/u01/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=chicagoXDB)'

* .log_archive_dest_1='LOCATION=/home/oracle/arch'

* .log_archive_format='%t_%s_%r.arc'

* .memory_target=1440m

* .open_cursors=300

* .processes=300

* .remote_login_passwordfile='EXCLUSIVE'

* .undo_tablespace='UNDOTBS1'

# for ADG

DB_UNIQUE_NAME=chicago

LOG_ARCHIVE_CONFIG='DG_CONFIG= (chicago,boston)'

LOG_ARCHIVE_DEST_1=

'LOCATION=/home/oracle/arch

VALID_FOR= (ALL_LOGFILES,ALL_ROLES)

DB_UNIQUE_NAME=chicago'

LOG_ARCHIVE_DEST_2=

'SERVICE=boston ASYNC

VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=boston'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE

LOG_ARCHIVE_FORMAT=%t_%s_%r.arc

FAL_SERVER=boston

FAL_CLIENT=chicago

DB_FILE_NAME_CONVERT='boston','chicago'

LOG_FILE_NAME_CONVERT='boston','chicago'

STANDBY_FILE_MANAGEMENT=AUTO

6. Copy the pfile file of the main library and change it to the pfile of the standby library

[oracle@snow dbs] $cp initchicago.ora initboston.ora

[oracle@snow dbs] $vi initboston.ora

* .audit_file_dest='/u01/app/oracle/admin/boston/adump'

* .audit_trail='db'

* .compatible='12.1.0.0.0'

* .control_files='/home/oracle/dbfile/boston/control01.ctl','/home/oracle/dbfile/boston/control02.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_name='chicago'

* .diagnostic_dest='/u01/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=chicagoXDB)'

* .log_archive_dest_1='LOCATION=/home/oracle/arch'

* .log_archive_format='%t_%s_%r.arc'

* .memory_target=1440m

* .open_cursors=300

* .processes=300

* .remote_login_passwordfile='EXCLUSIVE'

* .undo_tablespace='UNDOTBS1'

# for ADG

DB_UNIQUE_NAME=boston

LOG_ARCHIVE_CONFIG='DG_CONFIG= (boston,chicago)'

LOG_ARCHIVE_DEST_1=

'LOCATION=/home/oracle/arch

VALID_FOR= (ALL_LOGFILES,ALL_ROLES)

DB_UNIQUE_NAME=boston'

LOG_ARCHIVE_DEST_2=

'SERVICE=boston ASYNC

VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=chicago'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE

LOG_ARCHIVE_FORMAT=%t_%s_%r.arc

FAL_SERVER=chicago

FAL_CLIENT=boston

DB_FILE_NAME_CONVERT='chicago','boston'

LOG_FILE_NAME_CONVERT='chicago','boston'

STANDBY_FILE_MANAGEMENT=AUTO

7. Scp the pfile file of the library to the / u01/app/oracle/product/12.1.0/db_1/dbs of the library

[oracle@snow dbs] $scp initboston.ora boston:/u01/app/oracle/product/12.1.0/db_1/dbs

Oracle@boston's password:

Initboston.ora 100% 1141 1.1KB/s 00:00

8. Copy the password file of the master library, change it to the password file of the slave library, and scp to the / u01/app/oracle/product/12.1.0/db_1/dbs of the slave library.

[oracle@snow dbs] $cp orapwchicago orapwboston

[oracle@snow dbs] $scp orapwboston boston:/u01/app/oracle/product/12.1.0/db_1/dbs

Oracle@boston's password:

Orapwboston 100% 7680 7.5KB/s 00:00

9. Modify the $ORACLE_HOME/network/admin/tnsnames.ora of the main library and manually add (blue) the boston part of the standby library. Where CHICAGO is the link string of CDB and PDB1 is the link string of PDB.

[oracle@snow dbs] $cd $ORACLE_HOME/network/admin

[oracle@snow admin] $vi tnsnames.ora

BOSTON =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.13) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = boston)

)

)

CHICAGO =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = snow.oracle.com) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = chicago)

)

)

PDB1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.12) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = pdb1)

)

)

Reserve database operation

10. Create a directory required for the standby library

Confirm that the firewall is turned off like the main library

[root@boston ~] # service iptables stop

[oracle@boston ~] $export ORACLE_SID=boston

[oracle@boston] $mkdir-p $ORACLE_BASE/admin/boston/adump

[oracle@boston] $mkdir-p dbfile/boston/pdbseed

[oracle@boston] $mkdir-p dbfile/boston/pdb1

Note: if only the dbfile/boston directory is created, and the pdbseed and pdb1 directories are not created, the subsequent duplicate operation will fail.

ORA-19504: failed to create file "/ home/oracle/dbfile/boston/pdbseed/system01.dbf"

11. Create static snooping for slave libraries, which can be done using netmgr

[oracle@boston ~] $vi $ORACLE_HOME/network/admin/listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = boston)

(ORACLE_HOME = / u01/app/oracle/product/12.1.0/db_1)

(SID_NAME = boston)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = boston) (PORT = 1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

ADR_BASE_LISTENER = / u01/app/oracle

twelve。 Modify the standby tnsnames.ora and add the CHICAGO of the main library (blue)

[oracle@boston ~] $vi $ORACLE_HOME/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

BOSTON =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.13) (PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = boston)

)

)

CHICAGO =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.12) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = chicago)

)

)

13. Slave reload listener

[oracle@boston ~] $lsnrctl

LSNRCTL > reload

Main library operation

14. The main library creates a spfile from the modified pfile and starts the instance. At this point, the configuration information about ADG will take effect with the launch of the instance.

[oracle@snow ~] $sqlplus sys/oracle@chicago as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Fri May 1 18:13:45 2015

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

Connected to an idle instance.

SYS@chicago > create spfile from pfile

File created.

SYS@chicago > startup

Reserve database operation

15. The slave database creates a spfile from the modified pfile, and launches the instance to the nomount status.

[oracle@boston dbs] $sqlplus sys/oracle@boston as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed May 6 13:03:06 2015

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

Connected to an idle instance.

SYS@boston > create spfile from pfile

File created.

SYS@boston > startup nomount

ORACLE instance started.

Total System Global Area 459304960 bytes

Fixed Size 2289544 bytes

Variable Size 381681784 bytes

Database Buffers 71303168 bytes

Redo Buffers 4030464 bytes

SYS@boston > exit

16. Use rman duplicate to copy the main library online. Rman part of the output is relatively large, naming statements are marked with a highlight table, and other fonts are screen output.

[oracle@boston ~] $rman target sys/oracle@chicago auxiliary sys/oracle@boston

Recovery Manager: Release 12.1.0.1.0-Production on Mon May 25 14:27:16 2015

Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.

Connected to target database: CHICAGO (DBID=1488305431)

Connected to auxiliary database: CHICAGO (not mounted)

RMAN > duplicate target database for standby from active database dorecover nofilenamecheck

Starting Duplicate Db at 25-MAY-15

Using target database control file instead of recovery catalog

Allocated channel: ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: SID=20 device type=DISK

Current log archived

Contents of Memory Script:

{

Backup as copy reuse

Targetfile'/ u01 targetfile'/ u01 auxiliary format

'/ u01apapwboston`

}

Executing Memory Script

Starting backup at 25-MAY-15

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=265 device type=DISK

Finished backup at 25-MAY-15

Contents of Memory Script:

{

Restore clone from service 'chicago' standby controlfile

}

Executing Memory Script

Starting restore at 25-MAY-15

Using channel ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: restoring control file

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Output file name=/home/oracle/dbfile/boston/control01.ctl

Output file name=/home/oracle/dbfile/boston/control02.ctl

Finished restore at 25-MAY-15

Contents of Memory Script:

{

Sql clone 'alter database mount standby database'

}

Executing Memory Script

Sql statement: alter database mount standby database

Contents of Memory Script:

{

Set newname for tempfile 1 to

"/ home/oracle/dbfile/boston/temp01.dbf"

Set newname for tempfile 2 to

"/ home/oracle/dbfile/boston/pdbseed/pdbseed_temp01.dbf"

Set newname for tempfile 3 to

"/ home/oracle/dbfile/boston/pdb1/pdb1_temp01.dbf"

Switch clone tempfile all

Set newname for datafile 1 to

"/ home/oracle/dbfile/boston/system01.dbf"

Set newname for datafile 3 to

"/ home/oracle/dbfile/boston/sysaux01.dbf"

Set newname for datafile 4 to

"/ home/oracle/dbfile/boston/undotbs01.dbf"

Set newname for datafile 5 to

"/ home/oracle/dbfile/boston/pdbseed/system01.dbf"

Set newname for datafile 6 to

"/ home/oracle/dbfile/boston/users01.dbf"

Set newname for datafile 7 to

"/ home/oracle/dbfile/boston/pdbseed/sysaux01.dbf"

Set newname for datafile 8 to

"/ home/oracle/dbfile/boston/pdb1/system01.dbf"

Set newname for datafile 9 to

"/ home/oracle/dbfile/boston/pdb1/sysaux01.dbf"

Set newname for datafile 10 to

"/ home/oracle/dbfile/boston/pdb1/SAMPLE_SCHEMA_users01.dbf"

Set newname for datafile 11 to

"/ home/oracle/dbfile/boston/pdb1/example01.dbf"

Restore

From service 'chicago' clone database

Sql 'alter system archive log current'

}

Executing Memory Script

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Renamed tempfile 1 to / home/oracle/dbfile/boston/temp01.dbf in control file

Renamed tempfile 2 to / home/oracle/dbfile/boston/pdbseed/pdbseed_temp01.dbf in control file

Renamed tempfile 3 to / home/oracle/dbfile/boston/pdb1/pdb1_temp01.dbf in control file

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Starting restore at 25-MAY-15

Using channel ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00001 to / home/oracle/dbfile/boston/system01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00003 to / home/oracle/dbfile/boston/sysaux01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00004 to / home/oracle/dbfile/boston/undotbs01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00005 to / home/oracle/dbfile/boston/pdbseed/system01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00006 to / home/oracle/dbfile/boston/users01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00007 to / home/oracle/dbfile/boston/pdbseed/sysaux01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00008 to / home/oracle/dbfile/boston/pdb1/system01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00009 to / home/oracle/dbfile/boston/pdb1/sysaux01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00010 to / home/oracle/dbfile/boston/pdb1/SAMPLE_SCHEMA_users01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Channel ORA_AUX_DISK_1: starting datafile backup set restore

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set

Channel ORA_AUX_DISK_1: restoring datafile 00011 to / home/oracle/dbfile/boston/pdb1/example01.dbf

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03

Finished restore at 25-MAY-15

Sql statement: alter system archive log current

Current log archived

Contents of Memory Script:

{

Restore clone force from service 'chicago'

Archivelog from scn 2165528

Switch clone datafile all

}

Executing Memory Script

Starting restore at 25-MAY-15

Using channel ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: starting archived log restore to default destination

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: restoring archived log

Archived log thread=1 sequence=82

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Channel ORA_AUX_DISK_1: starting archived log restore to default destination

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: restoring archived log

Archived log thread=1 sequence=83

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Channel ORA_AUX_DISK_1: starting archived log restore to default destination

Channel ORA_AUX_DISK_1: using network backup set from service chicago

Channel ORA_AUX_DISK_1: restoring archived log

Archived log thread=1 sequence=84

Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 25-MAY-15

Datafile 1 switched to datafile copy

Input datafile copy RECID=7 STAMP=880640897 file name=/home/oracle/dbfile/boston/system01.dbf

Datafile 3 switched to datafile copy

Input datafile copy RECID=8 STAMP=880640897 file name=/home/oracle/dbfile/boston/sysaux01.dbf

Datafile 4 switched to datafile copy

Input datafile copy RECID=9 STAMP=880640897 file name=/home/oracle/dbfile/boston/undotbs01.dbf

Datafile 5 switched to datafile copy

Input datafile copy RECID=10 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdbseed/system01.dbf

Datafile 6 switched to datafile copy

Input datafile copy RECID=11 STAMP=880640897 file name=/home/oracle/dbfile/boston/users01.dbf

Datafile 7 switched to datafile copy

Input datafile copy RECID=12 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdbseed/sysaux01.dbf

Datafile 8 switched to datafile copy

Input datafile copy RECID=13 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdb1/system01.dbf

Datafile 9 switched to datafile copy

Input datafile copy RECID=14 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdb1/sysaux01.dbf

Datafile 10 switched to datafile copy

Input datafile copy RECID=15 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdb1/SAMPLE_SCHEMA_users01.dbf

Datafile 11 switched to datafile copy

Input datafile copy RECID=16 STAMP=880640897 file name=/home/oracle/dbfile/boston/pdb1/example01.dbf

Contents of Memory Script:

{

Set until scn 2165825

Recover

Standby

Clone database

Delete archivelog

}

Executing Memory Script

Executing command: SET until clause

Starting recover at 25-MAY-15

Using channel ORA_AUX_DISK_1

Starting media recovery

Archived log for thread 1 with sequence 82 is already on disk as file / home/oracle/arch/1_82_878586712.arc

Archived log for thread 1 with sequence 83 is already on disk as file / home/oracle/arch/1_83_878586712.arc

Archived log for thread 1 with sequence 84 is already on disk as file / home/oracle/arch/1_84_878586712.arc

Archived log file name=/home/oracle/arch/1_82_878586712.arc thread=1 sequence=82

Archived log file name=/home/oracle/arch/1_83_878586712.arc thread=1 sequence=83

Archived log file name=/home/oracle/arch/1_84_878586712.arc thread=1 sequence=84

Media recovery complete, elapsed time: 00:00:00

Finished recover at 25-MAY-15

Finished Duplicate Db at 25-MAY-15

This ends with the creation of 12c CDB ADG.

After the slave database is created successfully, the CDB is in the mount state and the role is in the physical slave database. Open ADG step by step.

[oracle@boston ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon May 25 14:30:12 2015

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SYS@boston > select open_mode,database_role from v$database

OPEN_MODE DATABASE_ROLE

--

MOUNTED PHYSICAL STANDBY

Executing ALTER DATABAE OPEN for the slave puts the CDB in the open read only state.

SYS@boston > ALTER DATABASE OPEN

Database altered.

The standby database executes ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING ARCHIVED LOGFILE DISCONNECT to apply the archive logs passed by the main library in real time. Superimposed with the previously opened open read only to form an active dataguard

SYS@boston > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING ARCHIVED LOGFILE DISCONNECT

Database altered.

SYS@boston > select open_mode,database_role from v$database

OPEN_MODE DATABASE_ROLE

--

READ ONLY WITH APPLY PHYSICAL STANDBY

The process of enabling ADG will only place CDB in open read only, and will not enable pdb1 in mount state as open read only.

SYS@boston > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 MOUNTED

SYS@boston > alter pluggable database all open

Pluggable database altered.

Test the ADG effect and verify whether it can be synchronized in the standby database after the tablespace is created in the pdb1 of the main database.

The main library creates a tablespace tbs1 in pdb

SYS@chicago > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 MOUNTED

SYS@chicago >

SYS@chicago > alter pluggable database all open

Pluggable database altered.

SYS@chicago > alter session set container=pdb1

Session altered.

SYS@chicago > select name from v$datafile

NAME

/ home/oracle/dbfile/chicago/undotbs01.dbf

/ home/oracle/dbfile/chicago/pdb1/system01.dbf

/ home/oracle/dbfile/chicago/pdb1/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdb1/SAMPLE_SCHEMA_users01.dbf

/ home/oracle/dbfile/chicago/pdb1/example01.dbf

SYS@chicago > create tablespace tbs1 datafile'/ home/oracle/dbfile/chicago/pdb1/tbs1.dbf' size 5m

Tablespace created.

SYS@chicago > col file_name for A58

SYS@chicago > set lines 150

SYS@chicago > select file_name,file_id,con_id from cdb_data_files

FILE_NAME FILE_ID CON_ID

-

/ home/oracle/dbfile/chicago/pdb1/system01.dbf 8 3

/ home/oracle/dbfile/chicago/pdb1/sysaux01.dbf 9 3

/ home/oracle/dbfile/chicago/pdb1/SAMPLE_SCHEMA_users01.dbf 10 3

/ home/oracle/dbfile/chicago/pdb1/example01.dbf 11 3

/ home/oracle/dbfile/chicago/pdb1/tbs1.dbf 12 3

Verify that the tbs1 synchronization of the tablespace is successful in the slave database. But the delay is relatively large, and it took a long time for synchronization to succeed.

SYS@boston > select file_name,file_id,con_id from cdb_data_files

FILE_NAME FILE_ID CON_ID

-

/ home/oracle/dbfile/boston/pdb1/example01.dbf 11 3

/ home/oracle/dbfile/boston/pdb1/SAMPLE_SCHEMA_users01.dbf 10 3

/ home/oracle/dbfile/boston/pdb1/sysaux01.dbf 9 3

/ home/oracle/dbfile/boston/pdb1/tbs1.dbf 12 3

/ home/oracle/dbfile/boston/pdb1/system01.dbf 8 3

Finally, add pdb2 to the main library to prepare the synchronization effect of the library. Use the graphical tool dbca to create a new pdb on CDB chicago.

The backend alert output in the process of creating pdb2 in the main library is as follows:

CREATE PLUGGABLE DATABASE pdb2 ADMIN USER snow IDENTIFIED BY * ROLES= (CONNECT) file_name_convert= ('/ home/oracle/dbfile/chicago/pdbseed/system01.dbf','/home/oracle/dbfile/chicago/pdb2/system01.dbf')

'/ home/oracle/dbfile/chicago/pdbseed/sysaux01.dbf','/home/oracle/dbfile/chicago/pdb2/sysaux01.dbf','/home/oracle/dbfile/chicago/pdbseed/pdbseed_temp01.dbf','/home/oracle/dbfile/chicago/pdb2/temp01.dbf')

Sat May 02 01:27:44 2015

*

Pluggable Database PDB2 with pdb id-4 is created as UNUSABLE.

If any errors are encountered before the pdb is marked as NEW

Then the pdb must be dropped

*

Deleting old file#5 from file$

Deleting old file#7 from file$

Adding new file#13 to file$ (old file#5)

Adding new file#14 to file$ (old file#7)

Successfully created internal service pdb2 at open

ALTER SYSTEM: Flushing buffer cache inst=0 container=4 local

*

Post plug operations are now complete.

Pluggable database PDB2 with pdb id-4 is now marked as NEW.

*

Completed: CREATE PLUGGABLE DATABASE pdb2 ADMIN USER snow IDENTIFIED BY * ROLES= (CONNECT) file_name_convert= ('/ home/oracle/dbfile/chicago/pdbseed/system01.dbf','/home/oracle/dbfile/chicago/pdb2/system01.dbf'

'/ home/oracle/dbfile/chicago/pdbseed/sysaux01.dbf','/home/oracle/dbfile/chicago/pdb2/sysaux01.dbf','/home/oracle/dbfile/chicago/pdbseed/pdbseed_temp01.dbf','/home/oracle/dbfile/chicago/pdb2/temp01.dbf')

Alter pluggable database pdb2 open

Pluggable database PDB2 dictionary check beginning

Pluggable Database PDB2 Dictionary check complete

Due to limited space in shared pool (need 6094848 bytes, have 3981120 bytes), limiting Resource Manager entities from 2048 to 32

Opening pdb PDB2 (4) with no Resource Manager plan active

Sat May 02 01:27:47 2015

Setting Resource Manager plan SCHEDULER [0x420E]: DEFAULT_MAINTENANCE_PLAN via scheduler window

Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN at pdb PDB2 (4) via parameter

Sat May 02 01:27:47 2015

XDB installed.

XDB initialized.

Pluggable database PDB2 opened read write

Completed: alter pluggable database pdb2 open

CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE'/ home/oracle/dbfile/chicago/pdb2/pdb2_users01.dbf' SIZE 5m REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE'/ home/oracle/dbfile/chicago/pdb2/pdb2_users01.dbf' SIZE 5m REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

ALTER DATABASE DEFAULT TABLESPACE "USERS"

Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"

Sat May 02 01:28:00 2015

TABLE SYS.WRI$_OPTSTAT_HISTHEAD_HISTORY: ADDED INTERVAL PARTITION SYS_P221 (42125) VALUES LESS THAN (TO_DATE ('2015-05-03 00 TO_DATE,' SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')

TABLE SYS.WRI$_OPTSTAT_HISTGRM_HISTORY: ADDED INTERVAL PARTITION SYS_P241 (42125) VALUES LESS THAN (TO_DATE ('2015-05-03 00 TO_DATE,' SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')

Sat May 02 01:28:49 2015

Thread 1 cannot allocate new log, sequence 90

Private strand flush not complete

Current log# 2 seq# 89 mem# 0: / home/oracle/dbfile/chicago/redo02.log

Sat May 02 01:28:52 2015

Thread 1 advanced to log sequence 90 (LGWR switch)

Current log# 3 seq# 90 mem# 0: / home/oracle/dbfile/chicago/redo03.log

Sat May 02 01:28:53 2015

Archived Log entry 87 added for thread 1 sequence 89 ID 0x58b61e17 dest 1:

Sat May 02 01:28:53 2015

TT00: Standby redo logfile selected for thread 1 sequence 90 for destination LOG_ARCHIVE_DEST_2

At the same time, observe the alert log on the slave side to see the synchronization effect. From the log output, you can observe that the new data file is created under the new directory pdb2.

Boston alert.log

Recovery successfully copied file/ home/oracle/dbfile/boston/pdb2/system01.dbf from / home/oracle/dbfile/boston/pdbseed/system01.dbf

Recovery created file/ home/oracle/dbfile/boston/pdb2/system01.dbf

Successfully added datafile 13 to media recovery

Datafile # 13:'/ home/oracle/dbfile/boston/pdb2/system01.dbf'

Recovery copied files for tablespace SYSAUX

Recovery successfully copied file/ home/oracle/dbfile/boston/pdb2/sysaux01.dbf from / home/oracle/dbfile/boston/pdbseed/sysaux01.dbf

Recovery created file/ home/oracle/dbfile/boston/pdb2/sysaux01.dbf

Successfully added datafile 14 to media recovery

Datafile # 14:'/ home/oracle/dbfile/boston/pdb2/sysaux01.dbf'

Recovery created file/ home/oracle/dbfile/boston/pdb2/pdb2_users01.dbf

Successfully added datafile 15 to media recovery

Datafile # 15:'/ home/oracle/dbfile/boston/pdb2/pdb2_users01.dbf'

Media Recovery Waiting for thread 1 sequence 90 (in transit)

RFS [2]: Selected log 5 for thread 1 sequence 91 dbid 1488305431 branch 878586712

Mon May 25 15:12:53 2015

Instance list and file distribution after the creation of the main library

SYS@chicago > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 READ WRITE NO

4 PDB2 READ WRITE NO

SYS@chicago > select name from v$datafile

NAME

/ home/oracle/dbfile/chicago/system01.dbf

/ home/oracle/dbfile/chicago/sysaux01.dbf

/ home/oracle/dbfile/chicago/undotbs01.dbf

/ home/oracle/dbfile/chicago/pdbseed/system01.dbf

/ home/oracle/dbfile/chicago/users01.dbf

/ home/oracle/dbfile/chicago/pdbseed/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdb1/system01.dbf

/ home/oracle/dbfile/chicago/pdb1/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdb1/SAMPLE_SCHEMA_users01.dbf

/ home/oracle/dbfile/chicago/pdb1/example01.dbf

/ home/oracle/dbfile/chicago/pdb1/tbs1.dbf

NAME

/ home/oracle/dbfile/chicago/pdb2/system01.dbf

/ home/oracle/dbfile/chicago/pdb2/sysaux01.dbf

/ home/oracle/dbfile/chicago/pdb2/pdb2_users01.dbf

14 rows selected.

Instance list and file distribution of the repository

SYS@boston > show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

-

2 PDB$SEED READ ONLY NO

3 PDB1 READ ONLY NO

4 PDB2 MOUNTED

SYS@boston > select name from v$datafile

NAME

/ home/oracle/dbfile/boston/system01.dbf

/ home/oracle/dbfile/boston/sysaux01.dbf

/ home/oracle/dbfile/boston/undotbs01.dbf

/ home/oracle/dbfile/boston/pdbseed/system01.dbf

/ home/oracle/dbfile/boston/users01.dbf

/ home/oracle/dbfile/boston/pdbseed/sysaux01.dbf

/ home/oracle/dbfile/boston/pdb1/system01.dbf

/ home/oracle/dbfile/boston/pdb1/sysaux01.dbf

/ home/oracle/dbfile/boston/pdb1/SAMPLE_SCHEMA_users01.dbf

/ home/oracle/dbfile/boston/pdb1/example01.dbf

/ home/oracle/dbfile/boston/pdb1/tbs1.dbf

NAME

/ home/oracle/dbfile/boston/pdb2/system01.dbf

/ home/oracle/dbfile/boston/pdb2/sysaux01.dbf

/ home/oracle/dbfile/boston/pdb2/pdb2_users01.dbf

14 rows selected.

Some additions

The tnsnames will not be added automatically after the new pdb2 is created in the main library, and the blue pdb2 part needs to be added manually for client connection.

[oracle@snow admin] $more tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/12.1.0.1/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

BOSTON =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = boston) (PORT = 1521))

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = boston)

)

)

CHICAGO =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.12) (PORT = 1521))

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = chicago)

)

)

LISTENER_ALEX =

(ADDRESS = (PROTOCOL = TCP) (HOST = snow.oracle.com) (PORT = 1521))

PDB1 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.12) (PORT = 1521))

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = pdb1)

)

)

PDB2 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.228.12) (PORT = 1521))

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = pdb2)

)

)

Pdb2 is created in the main library, pdb2 is also created after preparing the application log of the library, and the pdb2 directory is created under the defined directory / home/oracle/dbfile/boston to store data files.

This is not something to worry about, but there will be problems in HP Unix. Unable to create the directory of pdb after preparing the application log of the library, resulting in the creation failure. Every time the main library creates a new pdb, you need to manually create the corresponding directory in the standby library.

[oracle@boston boston] $ll

Total 2351032

-rw-r- 1 oracle oinstall 18268160 May 25 15:26 control01.ctl

-rw-r- 1 oracle oinstall 18268160 May 25 15:26 control02.ctl

Drwxr-xr-x 2 oracle oinstall 4096 May 25 14:43 pdb1

Drwxr-x--- 2 oracle oinstall 4096 May 25 15:12 pdb2

Drwxr-xr-x 2 oracle oinstall 4096 May 25 14:31 pdbseed

-rw-r- 1 oracle oinstall 52429312 May 25 14:28 redo01.log

-rw-r- 1 oracle oinstall 52429312 May 25 14:28 redo02.log

-rw-r- 1 oracle oinstall 52429312 May 25 14:28 redo03.log

-rw-r- 1 oracle oinstall 52429312 May 25 15:12 redo04.log

-rw-r- 1 oracle oinstall 52429312 May 25 15:26 redo05.log

-rw-r- 1 oracle oinstall 52429312 May 25 14:28 redo06.log

-rw-r- 1 oracle oinstall 52429312 May 25 14:28 redo07.log

-rw-r- 1 oracle oinstall 807411712 May 25 15:13 sysaux01.dbf

-rw-r- 1 oracle oinstall 828383232 May 25 15:13 system01.dbf

-rw-r- 1 oracle oinstall 92282880 May 25 14:31 temp01.dbf

-rw-r- 1 oracle oinstall 361766912 May 25 15:13 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 May 25 15:13 users01.dbf

On how to understand Oracle 12c CDB ADG to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report