Saturday, July 22, 2006

Creating a Logical Standby Database (failed)

3:50 PM Practise creating a logical standby database on the same system under Linux
ref: http://download-east.oracle.com/docs/cd
/B10501_01/server.920/a96653/create_ls.htm#1070616
1. Identify the primary database datafile and logfile
SQL> select name from v$datafile
NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/ntbkdb1/system01.dbf
/opt/app/oracle/oradata/ntbkdb1/undotbs01.dbf
/opt/app/oracle/oradata/ntbkdb1/drsys01.dbf
/opt/app/oracle/oradata/ntbkdb1/example01.dbf
/opt/app/oracle/oradata/ntbkdb1/indx01.dbf
/opt/app/oracle/oradata/ntbkdb1/tools01.dbf
/opt/app/oracle/oradata/ntbkdb1/users01.dbf
/opt/app/oracle/oradata/ntbkdb1/xdb01.dbf
/opt/app/oracle/oradata/ntbkdb1/logmnrts.dbf

SQL> select group#, type, member from v$logfile;

GROUP# TYPE MEMBER
---------- ------- --------------------------------------------------------------------------------
1 ONLINE /opt/app/oracle/oradata/ntbkdb1/redo01.log
2 ONLINE /opt/app/oracle/oradata/ntbkdb1/redo02.log
3 ONLINE /opt/app/oracle/oradata/ntbkdb1/redo03.log

2. Make a Copy of the Primary Database
Step 1 Shutdown the primary database
Step 2 Copy the datafiles to a temporary place
% cp /opt/app/oracle/oradata/ntbkdb1/system01.dbf ~/ntbkdb1_stby/
...
% cp /opt/app/oracle/oradata/ntbkdb1/logmnrts.dbf ~/ntbkdb1_stby/
Step 3 Restart the primary database
Step 4 Create a backup copy of the control file for the standby database.
SQL> ALTER DATABASE BACKUP CONTROLFILE TO
2> '/home/oracle/ntbkdb1_stby/ntbkdb2.ctl';
note: here user ~ for /home/oracle is not valid

Step 5 Enable restricted session mode
SQL> alter system enable restricted session;

Step 6 Build the LogMiner Dictionary
SQL> execute dbms_logstdby.build;

Step 7 Disable restricted session mode
SQL> alter system disable restricted session;

Step 8 Identify the latest archived redo log
SQL> alter system archive log current;
SQL> SELECT NAME FROM V$ARCHIVED_LOG
2> WHERE (SEQUENCE#=(SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG
3> WHERE DICTIONARY_BEGIN = 'YES' AND STANDBY_DEST= 'NO'));

NAME
------------------------------------------------------------------------
/opt/app/oracle/oradata/ntbkdb1/arch/ntbkdb1_arch782.arc


3. Create a text version of initiliazaton parameter files

SQL> create pfile='/home/oracle/ntbkdb1_stby/initntbkdb2.ora'
from spfile;

4 Copy Files from the Primary Database Location to
the Standby Location

On the primary database, use an operating system copy utility to copy
the following binary files from the primary database
site to the standby site:
- Backup datafiles and control files created in 2.
- Latest archived redo log that was identified in step 8 of Section 2.
- Database initialization parameter file created in Section 3.

5. Set the initilization parameter file for the logic standby database

Caution:

Review the initialization parameter file for additional parameters that
may need to be modified. For example, you may need to modify the dump
destination parameters (background_dump_dest, core_dump_dest,
user_dump_dest) if the directory location on the standby database is
different from those specified on the primary database. In addition,
you may have to create some directories on the standby system if they
do not already exist.

6. create a window service ( not for unix system)

7. Configure listner for both primary and standby site
8. Enable Dead Connectiong Detection on the Standby System
in sqlnet.ora on the standby system, set
sqlnet.expire_time=2

9. Create Oracle Net Service Names

10. Start and mount the logical standby databatase

SQL> startup mount pfile='/home/oracle/ntbkdb1_stby/initntbkdb2.ora'
ORACLE instance started.

Total System Global Area 68228236 bytes
Fixed Size 451724 bytes
Variable Size 50331648 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
ORA-01990: error opening password file
'/opt/app/oracle/product/9.2.0.4/dbs/orapw'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3


fix:
orapwd file=orapwntbkdb2 password =oracle entries=8

after the fix no ORA-01990 etc errors

-------------------------------------------------------------------
Jul 23, 2006 11:30 AM -- continue to create a logical standby database

repeat step 10 first

11. Rename Data Files on the Logical Standby Database
12. Rename online redo log on the logical standby database

copied the online redo log to the new locaiton first

13. Turn on the database guard
sql> alter database guard all;
sql> alter database open resetlogs;

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/home/oracle/ntbkdb1_stby/system01.dbf'


!!!!!
This practise has problems. Do it again from begining!!

No comments: