How to build an Oracle 11g license uard

Source: Internet
Author: User

How to build an Oracle 11g license uard

 

I. Preparations
I have read many tutorials when preparing to build a tracing uard. I followed the tutorials and encountered problems. Then I don't know how to proceed to the next step.
Later, I went to the official document and sorted out my ideas. It was much easier.
Taking one master database and one slave database as an example, the idea of building DG is as follows:
Disable the firewall.
Configure ssh mutual trust (not required, reduce the number of passwords entered in SCP)
Operations on the master database:
1) enable the archive mode and forced logging;
2) Add standby logfile. The standby logfile group has one more than the logfile group;
3) modify the parameter file
4) Configure listener. ora and tnsnames. ora.
5) back up the database and Control Files
Slave database preparation:
1) copy the parameter files and password files in the master database to the slave database and modify the parameter files;
2) Copy listener. ora and tnsnames. ora in the master database to the slave database and modify the listener. ora file.
3) copy the backup to the slave database.
4) Create the corresponding folder on the slave Database
5) Start the slave database to nomount mode.
6) restore the database using RMAN on the slave Database
7) add standby logfile to the slave Database
8) Application Archiving
9) view the status
Ii. basic configuration preparation
2.1 install the database software on the primary server and the ORCL database, and install the database on the standby server.
2.2 disable Firewall
The primary server closes the Firewall:

 

Disable firewall on standby server

 

2.3 configure ssh mutual trust
Baidu's "linux scp password-free", I 'd like to find an article to read.
[Oracle @ primary dbs] $ ssh-keygen-t rsa
[Oracle @ primary dbs] $ scp ~ /. Ssh/id_rsa.pub oracle@192.168.62.202:/home/oracle/. ssh/authorized_keys

 

3. Master Database Configuration
1) enable forced logging:
SQL> ALTER DATABASE FORCE LOGGING;
Check whether the archive mode is used. If the archive mode is used, change it to the archive mode.
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
3) configure the standby logfile file. When the master database becomes a slave database, you can receive logs from the slave database.
Alter database add standby logfile group 4 ('/u01/app/oracle/oradata/orcl/redo_dg_021.log') size 50 M;
Alter database add standby logfile group 5 ('/u01/app/oracle/oradata/orcl/redo_dg_022.log') size 50 M;
Alter database add standby logfile group 6 ('/u01/app/oracle/oradata/orcl/redo_dg_023.log') size 50 M;
Alter database add standby logfile group 7 ('/u01/app/oracle/oradata/orcl/redo_dg_024.log') size 50 M;
3) Configure parameters for the master database: There are two Methods: Use alter system to modify parameters, and use static parameter files to modify parameters; I use the latter configuration method.
For parameter configuration, see 3-3 and 3-4 pages in Oracle Data Guard Concepts and Administration 11g Release 2 (11.2) E41134-03
Initorcl. ora does not need to be configured.

 

 

 

SQL> create pfile from spfile;
[Oracle @ primary ~] $ Cd $ ORACLE_HOME/dbs
[Oracle @ primary dbs] $ vim initorcl. ora
# Primary
# *. Db_name = 'orcl'
*. Db_unique_name = pri
*. LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (pri, sty )'
# *. Control_files = '/u01/app/oracle/oradata/orcl/control01.ctl', '/u01/app/oracle/oradata/orcl/control02.ctl'
*. LOG_ARCHIVE_DEST_1 = 'location =/u01/app/oracle/arch VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = pri'
*. LOG_ARCHIVE_DEST_2 = 'service = sty ASYNC VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = sty'
*. LOG_ARCHIVE_DEST_STATE_1 = ENABLE
*. LOG_ARCHIVE_DEST_STATE_2 = ENABLE
*. Remote_login_passwordfile = 'clusive'
*. LOG_ARCHIVE_FORMAT = % t _ % s _ % r. arc
# Standby role
*. FAL_SERVER = sty
*. DB_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orcl'
*. LOG_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orcl'
*. STANDBY_FILE_MANAGEMENT = AUTO
SQL> shutdown immediate
SQL> create spfile from pfile;
4) Configure listener. ora and tnsnames. ora on the master database.
Listener. ora on the master database:
[Oracle @ primary admin] $ cat listener. ora
# Listener. ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener. ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.201) (PORT = 1521 ))
)
ADR_BASE_LISTENER =/u01/app/oracle
Tnsnames. ora on the master database:
[Oracle @ primary admin] $ cat tnsnames. ora
# Tnsnames. ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames. ora
# Generated by Oracle configuration tools.
PRI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.201) (PORT = 1521 ))
)
(CONNECT_DATA =
(SID = orcl)
)
)
STY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.202) (PORT = 1521 ))
)
(CONNECT_DATA =
(SID = orcl)
)
)
After modification, restart the listener.
5) back up the database and Control Files
[Oracle @ primary admin] $ rman target sys/asd @ pri
RMAN> backup database format'/u01/app/oracle/backup/full_db _ % U ';
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/app/oracle/backup/sty. ctl ';
Iv. operations on the slave Database
1) copy the parameter files and password files in the master database to the slave database and modify the parameter files;
[Oracle @ primary admin] $ cd $ ORACLE_HOME/dbs
[Oracle @ primary dbs] $ scp initorcl. ora orapworcl oracle@192.168.62.202:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
Modify the parameter file:
Vim/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl. ora
*. Db_name = 'orcl'
*. DB_UNIQUE_NAME = sty
*. Control_files = '/u01/app/oracle/oradata/orcl/control01.ctl', '/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
*. DB_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orcl'
*. LOG_FILE_NAME_CONVERT = '/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orcl'
*. LOG_ARCHIVE_FORMAT = log % t _ % s _ % r. arc
*. LOG_ARCHIVE_DEST_1 = 'location =/u01/app/oracle/arch VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = sty'
*. LOG_ARCHIVE_DEST_2 = 'service = pri ASYNC VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = pri'
*. LOG_ARCHIVE_DEST_STATE_1 = ENABLE
*. LOG_ARCHIVE_DEST_STATE_2 = ENABLE
*. REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE
*. STANDBY_FILE_MANAGEMENT = AUTO
*. FAL_SERVER = pri
The modified part is highlighted in red.
Password File Description: when the master database has an authorization or revoking sysdba, you must update the password file on the slave database.
2) Copy listener. ora and tnsnames. ora in the master database to the slave database and modify the listener. ora file.
Run the following command on the master database:
[Oracle @ primary admin] $ scp listener. ora tnsnames. ora oracle@192.168.62.202:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
Run the following command on the slave database:
[Oracle @ standby ~] $ Cd/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[Oracle @ standby admin] $ vim listener. ora
Change 201 in the host to 202, that is, change the host to the IP address on the slave database machine. You do not need to modify tnsnames. ora.
Restart the listener after modification.

 

3) copy the backup to the slave database.
[Oracle @ primary backup] $ scp/u01/app/oracle/backup/* oracle@192.168.62.202:/u01/app/oracle/backup
4) Create the corresponding folder on the slave Database
[Oracle @ standby oracle] $ cd $ ORACLE_BASE
[Oracle @ standby oracle] $ ls
Arch backup checkpoints database product
[Oracle @ standby oracle] $ mkdir-p oradata/orcl
[Oracle @ standby oracle] $ mkdir-p admin/orcl/adump
[Oracle @ standby oracle] $ mkdir-p admin/orcl/dpdump
[Oracle @ standby oracle] $ mkdir-p admin/orcl/pfile
5) Start the slave database to nomount mode.
SQL> create spfile from pfile = '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl. ora ';
SQL> startup nomount;
6) restore the database using RMAN on the slave Database
[Oracle @ standby ~] $ Rman target sys/asd @ pri
RMAN> connect auxiliary/
Run {
Allocate auxiliary channel c1 device type disk;
Allocate auxiliary channel c2 device type disk;
Duplicate target database for standby nofilenamecheck dorecover;
Release channel c1;
Release channel c2;
}
Although this problem occurs at the end, the Standby database can still be opened.
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of Duplicate Db command at 17:38:36
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 16 and starting SCN of 1010403 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 15 and starting SCN of 1009794 found to restore
7) add standby logfile to the slave Database
Standby logfile is added to the slave database. During the test, the standby logfile group4 to group 7 are in the v $ logfile view, the/u01/app/oracle/oradata/orcl does not have these files. Therefore, you need to delete these logs and recreate them:
SQL> alter database open; # No standby logs have been created in the mount status
SQL> alter database drop logfile group 4;
SQL> alter database drop logfile group 5;
SQL> alter database drop logfile group 6;
SQL> alter database drop logfile group 7;
SQL> alter database add standby logfile group 4 ('/u01/app/oracle/oradata/orcl/redo_dg_021.log') size 50 M;
SQL> alter database add standby logfile group 5 ('/u01/app/oracle/oradata/orcl/redo_dg_022.log') size 50 M;
SQL> alter database add standby logfile group 6 ('/u01/app/oracle/oradata/orcl/redo_dg_023.log') size 50 M;
SQL> alter database add standby logfile group 7 ('/u01/app/oracle/oradata/orcl/redo_dg_024.log') size 50 M;
8) Application Archiving
-- Application Archiving
SQL> shutdown immediate;

 

SQL> startup mount;
Alter database recover managed standby database using current logfile disconnect from session;
-- Exit Archive
Alter database recover managed standby database cancel;

 


9) view the status
SQL> SELECT SEQUENCE #, FIRST_TIME, NEXT_TIME, APPLIED FROM V $ ARCHIVED_LOG ORDER BY SEQUENCE #;
SEQUENCE # FIRST_TIME NEXT_TIME APPLIED
-------------------------------------------------------
15 08-JUN-16 08-JUN-16 YES
16 08-JUN-16 08-JUN-16 YES
17 08-JUN-16 08-JUN-16 YES
18 08-JUN-16 08-JUN-16 YES
19 08-JUN-16 08-JUN-16 YES
20 08-JUN-16 08-JUN-16 YES
21 08-JUN-16 08-JUN-16 IN-MEMORY
It indicates that the DG has been set up successfully.

 

Note: If the slave database is open, the alarm log displays: ORA-16058: Alarm information for the slave database instance not loaded.

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

Important configuration parameters of Oracle Data Guard

Configure Oracle 11g Data Guard based on the same host

Explore Oracle 11g elastic uard

Oracle Data Guard (RAC + DG) archive deletion policies and scripts

Role conversion for Oracle Data Guard

FAL gap in Oracle Data Guard logs

Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.