Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Database 11g.pdf
Скачиваний:
78
Добавлен:
10.06.2015
Размер:
12.69 Mб
Скачать

Lab 8.1: Duplicating a Database Using Active Database Duplication 

727

validation succeeded for archived log archived log file

name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_20\ O1_MF_1_26_4HR9MCQX_.ARC RECID=50 STAMP=668565264

validation succeeded for archived log

archived log file name=C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ ARC00026_0667833490.001 RECID=49 STAMP=668565264 Crosschecked 5 objects

6.Run the list archivelog all command. Notice that the status column (so clearly named S) is now X (expired) instead of A (available):

RMAN> list archivelog all;

List of

Archived Log

Copies for database with db_unique_name ORCL

=====================================================================

Key

Thrd

Seq

S Low Time

-------

----

-------

- ---------

1773

1

23

A 18-OCT-08

 

Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00023_0667833490.001

1779

1

24

A 19-OCT-08

 

Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00024_0667833490.001

1787

1

25

X 19-OCT-08

 

Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00025_0667833490.001

1898

1

26

A 19-OCT-08

 

Name: C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_20\

O1_MF_1_26_4HR9MCQX_.ARC

1897

1

26

A 19-OCT-08

 

Name: C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00026_0667833490.001

Lab 8.1: Duplicating a Database Using

Active Database Duplication

In this exercise, we will use backup-based duplication to create a database on the same system that the target database resides on. For this exercise, your database should be running in ARCHIVELOG mode and all networking to the target database should already be configured.

1.If you are running in Windows, create the service for the new database with oradim. In this example, we are creating a new database instance called neworcl.

C:\>oradim -new -sid neworcl Instance created.

728  Appendix A  n  Lab Exercises

If there are any other OS-specific operations required to create a database instance, complete those now.

2.Create the password file for the neworcl instance.

C:\>orapwd file=c:\oracle\product\11.1.0\db_1\database\pwdneworcl.ora Enter password for SYS:

3.Create a temporary pfile for the neworcl auxiliary instance using your editor of choice. The pfile should be contained in the ORACLE_HOME\database directory of the auxiliary instance and should be named initneworcl.ora. The pfile should have these parameters in it:

db_name=neworcl memory_target=300m

control_files=’c:\oracle\oradata\neworcl\control01.ctl’, ‘c:\oracle\oradata\neworcl\control02.ctl’

We will do the actual file-location conversions during the duplication.

4.Create the directory c:\oracle\oradata\neworcl mkdir c:\oracle\oradata\neworcl

5.Startup nomount the auxiliary instance.

C:\oracle\product\11.1.0\db_1\database>set oracle_sid=neworcl C:\oracle\product\11.1.0\db_1\database>sqlplus “/ as sysdba” SQL*Plus: Release 11.1.0.6.0 - Production on Sat Oct 4 23:09:52 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to

an idle instance.

 

SQL> startup

nomount

 

 

ORACLE instance started.

 

 

Total System

Global Area

313860096 bytes

Fixed Size

 

1332892

bytes

Variable Size

 

192940388

bytes

Database Buffers

113246208 bytes

Redo Buffers

 

6340608

bytes

6.Configure service name resolution for your new auxiliary database. The method of this configuration will vary based on your site. In our case, we created an entry in the tnsnames.ora file on our server that looked like this:

NEWORCL = (DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) (CONNECT_DATA =

Lab 8.1: Duplicating a Database Using Active Database Duplication 

729

(SERVER = DEDICATED) (SERVICE_NAME = neworcl)

))

7.Now you will need to hard-code the instance name into the listener.ora file until the duplication of the database has been completed. You will get network errors if you do not hard-code the auxiliary instance in the listener.ora file. Here’s an example of the entry in our listener.ora:

SID_LIST_LISTENER = (SID_LIST = (SID_DESC =

(ORACLE_HOME=C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN) (SID_NAME=neworcl)

) )

LISTENER = (DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

))

8.Test the network connectivity to the auxiliary instance.

C:\oracle\product\11.1.0\db_1\database>sqlplus sys/robert@neworcl as sysdba SQL*Plus: Release 11.1.0.6.0 - Production on Sat Oct 4 23:17:50 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining

and Real Application Testing options

SQL> select instance_name from v$instance; INSTANCE_NAME

----------------

neworcl

If the connection fails, review the network configuration and ensure that the new auxiliary instance is running.

9.Start RMAN and connect to the target and the auxiliary databases.

C:\oracle\product\11.1.0\db_1\database>Set oracle_sid=orcl C:\oracle\product\11.1.0\db_1\database>Rman target=sys/robert

730  Appendix A  n  Lab Exercises

auxiliary=sys/Robert@neworcl

Recovery Manager: Release 11.1.0.6.0 - Production on Sat Oct 4 23:19:55 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORCL (DBID=1194923408) connected to auxiliary database: NEWORCL (not mounted)

10.We are now ready to start the database duplication. Issue the duplicate database command, as shown here:

duplicate target database to neworcl from active database nofilenamecheck

spfile set control_files ‘c:\oracle\oradata\neworcl\control01.ctl’, ‘c:\oracle\oradata\neworcl\control02.ctl’

set db_file_name_convert ’c:\oracle\oradata\orcl’,’c:\oracle\oradata\neworcl’

set log_file_name_convert ’c:\oracle\oradata\orcl’,’c:\oracle\oradata\ neworcl’;

This command does the following:

NNIt starts the duplication process. We are using active database duplication, so no database backup is required.

NNThe SPFILE parameter will result in the target database spfile being copied over to the duplicate database. The duplicate database will use this spfile.

NNThe set commands (set control_files, set db_file_name_convert, and set log_file_name_convert) modify or add parameters to the spfile being copied to the duplicate database.

This duplicate command will result in a great deal of output, which we have decided not to include here as it seems a great waste of a perfectly good tree. Here is the output that you hopefully will see at the end of the database duplication:

database opened

Finished Duplicate Db at 04-OCT-08

There are several bugs in 11.1.0.6 that may cause a failure of active database duplications. We experienced one or two of these when writing this book. This exercise should work well on a new database that has just been created or a database with the latest patch sets installed.

11.Connect to the duplicated database to verify it is open.

C:\oracle\product\11.1.0\db_1\database>set oracle_sid=neworcl C:\oracle\product\11.1.0\db_1\database>sqlplus sys/Robert as sysdba

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]