oracle 11g dg deployment rman way points record

1, Environment Introduction

ip hostname sid db_name db_unique_name net service name
192.168.56.118 oraclep yunhaip yunhaip yunhaip yunhaip
192.168.56.117 oracles yunhaip yunhaip yunhais yunhais

2, modify the hostname

hostnamectl set-hostname oraclep

3, db deployment

Owner: Create a library from: Do not create a database
that is not dbca that step, network and infrastructure environment is still needed

4, the main library open archives and to set a mandatory log force logging

SQL> shutdown immediate

Stop database operations

startup mount

State started to mount

alter database archivelog;

Open archives

alter database force logging;

Forced log, i.e., all operations for the database are generated log information, and writes the information to the online redo log file.

alter database open;

Open the database

archive log list;

To get data archiving mode

select force_logging from v$database;

Are you sure the log is forced

5, the main library to add standby redo log

select member from v$logfile;

View standby redo and redo

select * from v$log;

Check redo case

alter database add standby logfile group 21 '/u01/app/oradata/yunhaip/standby21.log' size 50M;
alter database add standby logfile group 22 '/u01/app/oradata/yunhaip/standby22.log' size 50M;
alter database add standby logfile group 23 '/u01/app/oradata/yunhaip/standby23.log' size 50M;
alter database add standby logfile group 24 '/u01/app/oradata/yunhaip/standby24.log' size 50M;

By a group of standby redo 50M in size, where the group numbers shall not be repeated and online redo, formal environment need to adjust the file size

6, modify the configuration file
6.1, the main library pfile created in order to make changes

SQL>create pfile from spfile;
SQL> host
[oracle@oraclep ~]$ cd $ORACLE_HOME/dbs
[oracle@oraclep dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
cat >> /u01/app/oracle/product/11.2.0/db_1/dbs/inityunhaip.ora << "EOF"
*.db_unique_name='yunhaip'
*.fal_server='yunhais'
*.log_archive_config='dg_config=(yunhaip,yunhais)'
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=yunhaip'
*.log_archive_dest_2='service=yunhais lgwr async valid_for=(online_logfile,primary_role) db_unique_name=yunhais'
*.log_archive_dest_state_1=ENABLE
*.log_archive_dest_state_2=ENABLE
*.standby_file_management='AUTO'
*.db_file_name_convert='/u01/app/oradata/yunhaip','/u01/app/oradata/yunhaip'
*.log_file_name_convert='/u01/app/oradata/yunhaip','/u01/app/oradata/yunhaip'
EOF

6.2, the master copy of the library from the library to pfile, and the following modifications:

[oracle@oraclep dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@oraclep dbs]$ scp inityunhaip.ora
192.168.56.117:/u01/app/oracle/product/11.2.0/db_1/dbs/

cat >> /u01/app/oracle/product/11.2.0/db_1/dbs/inityunhaip.ora << "EOF"
*.db_unique_name='yunhais'
*.fal_server='yunhaip'
*.log_archive_config='dg_config=(yunhaip,yunhais)'
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=yunhais'
*.log_archive_dest_2='service=yunhaip lgwr async valid_for=(online_logfile,primary_role) db_unique_name=yunhaip'
*.log_archive_dest_state_1=ENABLE
*.log_archive_dest_state_2=ENABLE
*.standby_file_management='AUTO'
*.db_file_name_convert='/u01/app/oradata/yunhaip','/u01/app/oradata/yunhaip'
*.log_file_name_convert='/u01/app/oradata/yunhaip','/u01/app/oradata/yunhaip'
EOF

6.3 Description:

dg_config = (yunhaip, yunhais) except where the main information from the other can be reversed

6.4, create a new master database spfile file, and restart the main library

SQL> shutdown immediate
SQL> create spfile from pfile;
SQL> startup
SQL> ALTER USER SYS IDENTIFIED BY sys;

Modify the sys password for future use rman connection

6.5, the main library to copy the password file to the standby database

scp orapwyunhaip 192.168.56.117:/u01/app/oracle/product/11.2.0/db_1/dbs/

7, create the relevant directory from the library

strings spfileyunhaip.ora

Get directory, I have observed that the main library

mkdir -p /u01/app/oracle
mkdir -p /u01/app/admin/yunhaip/{a,b,c,d,u}dump
mkdir -p /u01/app/oradata/yunhaip/
mkdir -p /u01/app/fast_recovery_area/yunhaip/

8, create a tnsnames.ora, from the same master to

cat >> /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora << "EOF"
yunhaip =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.118)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yunhaip)
)
)

yunhais =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.117)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yunhais)
)
)
EOF

9, listener.ora modify the backup library

cat >> /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora << "EOF"
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = yunhais)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = yunhaip)
)
)

EOF

原因如下:
[oracle@oracles ~]$ rman target sys/sys@yunhaip auxiliary sys/sys@yunhais
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 3 15:43:07 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: YUNHAIP (DBID=665781658)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-12528: TNS:listener: all appropriate instances are blocking new connections

10, from the library to try to start nomount

SQL> create spfile from pfile;
SQL> startup nomount

. 11, the master database to the backup copy RMAN library
11.1, RMAN first database connected to the main and standby database

rman target sys/sys@yunhaip auxiliary sys/sys@yunhais

If there are related error, please note 9,6.4 steps

11.2, using the RMAN duplicate copy command, the same directory structure on both sides is necessary to add parameters nofilenamecheck

duplicate target database for standby from active database nofilenamecheck;

12, copied, from the library of the correlation process

select status from v$instance;

Queries from the library is in a state MOUNTED

alter database recover managed standby database using current logfile disconnect from session;

Open real-time log application in the standby database

13, observed from the right master state
13.1, the primary library was observed alert log

Vim Alrt_yunhapklog

Error 12154 received logging on to the standby find this error

13.2 restart the main library

SQL> shutdown immediate;
SQL> startup;

13.3 Observation primary database state:

SQL> select switchover_status,database_role from v$database;

SWITCHOVER_STATUS DATABASE_ROLE


TO STANDBY PRIMARY

13.4, as seen from the state library

SQL> select switchover_status,database_role from v$database;

SWITCHOVER_STATUS DATABASE_ROLE


NOT ALLOWED PHYSICAL STANDBY

14, by switching the observed log synchrony
14.1, switching the primary database

SQL> archive log list;
SQL> alter system switch logfile;
SQL> archive log list;

14.2, viewed from library

SQL> archive log list;

15, from the library Open, so that the user can read

alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect ;

[oracle@oracles ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 3 15:59:46 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect ;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

16, the experiment
16.1 was observed existing data from the library

[oracle@oracles ~]$ sqlplus test/test
SQLPlus: Release 11.2.0.3.0 Production on Wed Jul 3 16:01:59 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select
from test;
ID NUMS


1 2
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oracles ~]$ exit
登出
Connection to 192.168.56.117 closed.

16.2, add a new main library data

[oracle@oraclep trace]$ sqlplus test/test
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 3 16:02:19 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> insert into test values(2,2);
1 row created.
SQL> commit;
Commit complete.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

16.3 observe the new data from the library

[oracle@oraclep trace]$ ssh 192.168.56.117
[email protected]'s password:
Last login: Wed Jul 3 16:01:52 2019 from 192.168.56.118
[oracle@oracles ~]$ sqlplus test/test
SQLPlus: Release 11.2.0.3.0 Production on Wed Jul 3 16:02:36 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select
from test;
ID NUMS


1 2
2 2

Guess you like

Origin blog.51cto.com/860143/2416732