Dataguard configuration under Linux9i

Source: Internet
Author: User
Datag9i Dataguard configuration-Linux Enterprise Application-Linux server application information. The following is a detailed description. Author: wangyl1977

Environment:
OS: linux 9
Oracle: oracle9i
Primary: 1.1.1.1
Standby: 1.1.1.2 (both master and slave hosts are normal pc hosts)

Part 1 oracle9i installation on linux9

I didn't want to write this stuff, but compared with the installation of oracl9i under solaris and linux, the installation of oracle9i on linux9 is really a lot of trouble, next I will briefly introduce the problems I encountered (it seems that most oracle beginners encountered problems during installation). The installation of oracle9i on linux9 has been tossing me for several months, I am too stupid.

1) An error is reported when runinstaller is running.
-Bash-2.05b $./runInstaller
-Bash-2.05b $ Initializing Java Virtual Machine from/tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/java. Please wait...
/Tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/i386/native_threads/java: error while loading shared libraries: libstdc ++-libc6.1-1. so.2: cannot open shared object file: No such file or directory
Oracle Net configuration Assistant
Oracle Database configuration Assistant
Agent configuration Assistant
The details error messages of the three tools are:
/Home/oracle/jre/1.1.8/bin .. /lib/i686/native_threads/libzip. so: symbol errno, version GLIBC_2.0 not definded in file libc. so.6 with link time reference (libzip. so)
Unable to initialize threads: cannot find class java/lang/Thread
Cocould not create java VM
Solution:
Perform the following steps before running runInstaller.
Export LD_ASSUME_KERNEL = 2.4.19
Ignore your kernal version
Download the libcwait file. c ftp://people.redhat.com/drepper/libcwait.c (through IE can not be downloaded, use the command line) with gcc-shared-o libcwait. so-fpic-O2 libcwait. c compile and then export LD_PRELOAD =/$ path/libcwait. so
The preceding method enables Oracle Net configuration Assistant and Oracle Database configuration Assistant to be installed successfully.



To fix the failure of Agent configuration Assistant configuration, see
Successfully installed Oracle9204 on RHAS3 by: renxiao2003
Bytes ----------------------------------------------------------------------------------------------
After running runInstaller, the installation component selection result is displayed. Click "Install" to start installation and copy the file. The progress bar is increased at. After the installation and link are complete, the Configuration tool interface appears. The agent service cannot be configured successfully. Ignore this interface and fix it as follows. DBCA, NETCA, and HTTP are all correctly configured. Haha. The following describes how to fix the error. In fact, it would be better to capture the various interfaces.
Install the p3238244_9204_linux.zip patch in 6379.
This patch is also downloaded from the http://metalink.oracle.com, while downloading an opatch package: p2617419_220_GENERIC.zip, which is mainly used to handle errors that the agent service cannot start.
The process is as follows: [quote: 864939f94a] su-oracle
$ Cp p2617419_210_GENERIC.zip/tmp
$ Cd/tmp
$ Unzip p2617419_210_GENERIC.zip
$ Export PATH = $ PATH:/tmp/OPatch
$ Export PATH = $ PATH:/sbin # the patch needs "fuser" which is located in/sbin
$ Unzip p3238244_9204_LINUX.zip
$ Cd 3238244
$ Opatch apply

: 864939f94a] After the patch is fixed, A. mk file needs to be relinked.
$ Cd $ ORACLE_HOME/network/lib
$ Make-f ins_oemagent.mk install
Run agentctl start to check whether the agent service can be successfully run. You can use stop and status to stop the service or check the service status.
After the successful installation, Oracle cannot be started, but the initialization file cannot be found. I used dbca to delete the database created during the original installation and then re-establish the database.
7. Run dbca to create a database. Well, all the way to complete database installation.
We hope you can also install it successfully.


After runInstaller is run, garbled characters are displayed on the installation page.
Export LANG = en_us run runInstaller again (this is the simplest and most practical method)


/Etc/oratab error reported
If it has been installed on the machine before, the/etc/oratab error is reported again during installation. Clear/etc/oratab (delete)
Cp/dev/null/etc/oratab
(4) then begin database creation. When the database is created to 46%, the shared memory problem may occur,
ORA-27123: unable to attach to shared memory segment
In this case, you need to specify the memory for the kernel. You can:
Echo 4294967295>/proc/sys/kernel/shmmax
Or
Edit/etc/sysctl. conf
Kernel. shmmax = 4294967295
In this way, you can install the database.
Run: To start oracle, run the Database Listener: lsnrctl start to close: lsnrctl stop
Run the oemapp console to open the oracle Enterprise Manager tool.

There are also some errors, which may need to be modified by/etc/hosts,/etc/sysctl. conf. Please search google and follow the methods prompted by netizens.
In addition, the Directory of the master and slave hosts is set to the same. Set the oracle user home directory to/home/oracle. the database names of the master and slave hosts are set to oracle, And the instance names are also set to oracle, whether or not the Database Name of the master and slave hosts must be set to the same instance name. I posted a post on the cu and asked, as if everyone said no, but our dba said yes, what I set here is the same.

Step 2: Configure Dataguard
First, set both the master and slave hosts to archive mode.
1. The master node backs up and generates backup Database Control Files
Log on to the master node to back up the database and generate a backup database control file.
[Oracle @ primary] $ sqlplus "/as sysdba"
SQL> startup
SQL> shutdown immediate
SQL> exit

[Oracle @ primary] pwd
/Home/oracle
[Oracle @ primary] $ ls
Admin dictionary. ora jre oradata oraInventory oui product soft
[Oracle @ primary] tar-cvf oradata.tar oradata
[Oracle @ primary] $ ls-l *. tar
-Rw-r -- 1 oracle dba 576512000 Aug 16 oradata.tar
[Oracle @ primary] $ sqlplus "/as sysdba"
SQL> startup
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination/home/oracle/oradata/primary/archive
Oldest online log sequence 88
Next log sequence to archive 90
Current log sequence 90
SQL> alter database create standby controlfile as '/home/oracle/standby. ctl ';
Database altered.
SQL> exit
[Oracle @ primary]

3. Hosts file), backup control file (/home/oracle/standby. ctl), and password file (orapworacle under $ ORACLE_HOME/dbs/) to the corresponding location in standby.
Procedure:
3.1 In standby/home/oracle/oradata, there is an oracle folder (which contains the dbf and redolog files under the host), and a new primary folder. Put all the files unlocked by oradata.tar in primary (that is, there are no folders in primary) under primary, and put the generated backup control file (/home/oracle/standby. ctl) under primary.

3.2 In ORACLE_HOME/dbs/of standby, first back up the previous orapworacle (Change the name ), put the orapworacle file ftp under $ ORACLE_HOME/dbs/of primary to ORACLE_HOME/dbs/of standby.
Note: I have not mentioned this point in reading the masterpiece of eygle and many related articles, but if I do not do this step, when I start the backup database
[Oracle @ eygle primary] $ sqlplus "/as sysdba"
SQL> startup nomount;
SQL> alter database mount standby database;
SQL> alter database recover managed standby database disconnect from session;
This step will be reported ORA-01991 error, said Invalid passwd file. ask our dba, saying that it is necessary to replace standby with orapworacle of primary. I tried it. After doing so, it will be OK.
So here I will replace orapworacle of primary with orapworacle of standby as a required step, but I am not sure whether this step is necessary. If not, why is there always an error when I do this. If necessary, why is this step not mentioned in the masterpiece of eygle and other Daniel? Is it because it is too simple ?? I have some doubts. If you see this, please give me a positive answer. I am very grateful.

The oracle directory originally exists under $ oracle/home/admin of the standby host. Create now
In the primary directory, create bdump, cdump, and udump under the primary directory.
Primary parameter file

Oracle @ primary_andy $ cat. bash_profile
#. Bash_profile

# Get the aliases and functions
# If [-f ~ /. Bashrc]; then
#.~ /. Bashrc
# Fi

# User specific environment and startup programs
# Export BASH_ENV = $ HOME/. bashrc

PATH = $ PATH:/home/oracle/product/9.2.0/bin: $ oracle_home/jre/bin:/opt/SUNWspro/bin:/usr/bin: /usr/ccs/bin:/usr/ucb:/etc:/usr/local/bin:/usr/bin/saved:
Export PATH
Unset USERNAME
ORACLE_OWNER = oracle
ORACLE_BASE =/home/oracle
Export ORACLE_BASE
ORACLE_HOME =/home/oracle/product/9.2.0
Export ORACLE_HOME
LANG =
LC_ALL =
ORACLE_SID = oracle
Export ORACLE_SID

TNS_ADMIN =/home/Oracle/config/9.2.0; export TNS_ADMIN
NLS_LANG = american_america.ZHS16GBK; export NLS_LANG
# ORA_NLS33 = $ Oracle_HOME/ocommon/nls/admin/data; export ORA_NLS33
CLASSPATH = $ Oracle_HOME/JRE: $ Oracle_HOME/jlib: $ Oracle_HOME/rdbms/jlib:/opt/j2sdk_nb/j2sdk1.4.2/bin
Export CLASSPATH
TMPDIR =/tmp; export TMPDIR
Umask 022
LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/lib/tls:/lib/i686:/usr/openwin/lib:/usr/dt/lib
Export LD_LIBRARY_PATH
Export LD_PRELOAD =/home/oracle/libcwait. so;
Export LD_ASSUME_KERNEL = 2.4.19;
DISPLAY = 1.1.1.3: 0.0; export DISPLAY;
Export PS1 = "\ u @ \ H $"

# Cat initoracle. ora_primary
*. Aq_tm_processes = 1
*. Background_dump_dest = '/home/oracle/admin/oracle/bdump'
*. Compatible = '9. 2.0.0.0'
*. Control_files = '/home/oracle/oradata/oracle/control01.ctl', '/home/oracle/oradata/oracle/c
Ontrol02.ctl ','/home/oracle/oradata/oracle/control03.ctl'
*. Core_dump_dest = '/home/oracle/admin/oracle/cdump'
*. Db_block_size = 8192
*. Db_cache_size = 33554432
*. Db_domain =''
*. Db_file_multiblock_read_count = 16
*. Db_name = 'oracle'
*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = oracleXDB )'
*. Fast_start_mttr_target = 300
*. Hash_join_enabled = TRUE
*. Instance_name = 'oracle'
*. Java_pool_size = 83886080
*. Job_queue_processes = 10
*. Large_pool_size = 16777216
*. Log_archive_dest_1 = 'location =/home/oracle/oradata/archivelog /'
*. Log_archive_dest_2 = 'service = standby mandatory reopen = 60'
*. Log_archive_dest_state_1 = 'enable'
*. Log_archive_format = 'Log _ % t _ % s. arc'
*. Log_archive_start = TRUE
*. Open_cursors = 300
*. Pga_aggregate_target = 25165824
*. Processses = 150
*. Query_rewrite_enabled = 'false'
*. Remote_login_passwordfile = 'clusive'
*. Shared_pool_size = 83886080
*. Sort_area_size = 524288
*. Star_transformation_enabled = 'false'
*. Timed_statistics = TRUE
*. Undo_management = 'auto'
*. Undo_retention = 10800
*. Undo_tablespace = 'undotbs1'
*. User_dump_dest = '/home/oracle/admin/oracle/udump'

Modify the initoracle. ora file of the standby host (back up the file first). My initoracle. ora file is as follows for your reference.

*. Aq_tm_processes = 1
*. Background_dump_dest = '/home/oracle/admin/primary/bdump'
*. Compatible = '9. 2.0.0.0'
*. Control_files = '/home/oracle/oradata/primary/standby. ctl'
*. Core_dump_dest = '/home/oracle/admin/primary/cdump'
*. Db_block_size = 8192
*. Db_cache_size = 33554432
*. Db_domain =''
*. Db_file_multiblock_read_count = 16
*. Db_name = 'oracle'
*. Dispatchers = '(PROTOCOL = TCP) (SERVICE = oracleXDB )'
*. Fast_start_mttr_target = 300
*. Hash_join_enabled = TRUE
*. Instance_name = 'oracle'
*. Java_pool_size = 83886080
*. Job_queue_processes = 10
*. Large_pool_size = 16777216
*. Open_cursors = 300
*. Pga_aggregate_target = 25165824
*. Processses = 150
*. Query_rewrite_enabled = 'false'
*. Remote_login_passwordfile = 'clusive'
*. Shared_pool_size = 83886080
*. Sort_area_size = 524288
*. Star_transformation_enabled = 'false'
*. Timed_statistics = TRUE
*. Undo_management = 'auto'
*. Undo_retention = 10800
*. Undo_tablespace = 'undotbs1'
*. User_dump_dest = '/home/oracle/admin/primary/udump'
*. Log_archive_format = log _ % t _ % s. arc
*. Log_archive_start = TRUE
*. STANDBY_FILE_MANAGEMENT = AUTO
*. Log_archive_dest_1 = 'location =/home/oracle/oradata/archivelog /'
*. Log_archive_dest_state_1 = ENABLE
*. Fal_server = 'primary'
*. Fal_client = 'standby'
*. DB_FILE_NAME_CONVERT = ("/home/oracle/oradata/oracle", "/home/oracle/oradata/primary") ---- (directory in which data files of primary and secondary databases are converted to each other)
*. STANDBY_FILE_MANAGEMENT = AUTO to rename the data file of the master database !!
*. LOG_FILE_NAME_CONVERT = ("/home/oracle/oradata/archivelog", "/home/oracle/oradata/archivelog") ---- (directory of online log redolog conversion between primary and secondary databases)
*. STANDBY_ARCHIVE_DEST =/home/oracle/oradata/archivelog
---- (The directory from the archivelog generated by the primary database to the secondary database)
The bold option is newly added and is basically required. Red is a comment. Do not add it to the actual file.

4. Configure the tnsnames. ora file on the master node (on the primary host)
Primary = (description =
(Address =
(Protocol = tcp)
(Port = 1521)
(Host = 1.1.1.1 ))
(Connect_data =
(SID = oracle )))
Standby = (description =
(Address =
(Protocol = tcp)
(Port = 1521)
(Host = 1.1.1.2 ))
(Connect_data =
(SID = oracle )))
Similarly, the tnsnames. ora file on the slave node (standby)

5. Configure the listener. ora file on the slave node (standby), add the listening service standby_listener, and add relevant content in the corresponding section.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = oracle)
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME =/home/oracle/oradata)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 ))
)
)

Start lsnrctl on the master and slave databases,
-Bash-2.05b $ lsnrctl
LSNRCTL> start # start the listening service

6. Use tnsping on the master and slave nodes to test network connectivity

On the primary machine
-Bash-2.05b $ tnsping primary
-Bash-2.05b $ tnsping standby

On standby
-Bash-2.05b $ tnsping primary
-Bash-2.05b $ tnsping standby

7. Start the secondary Database

SQL> startup nomount;
SQL> alter database mount standby database;
Database altered.
SQL> alter database recover managed standby database disconnect from session;
Database altered.

8. Set the archive path on the master node
SQL> alter system set log_archive_dest_2 = 'service = standby mandatory reopen = 60 ';
System altered.
Defines the master database to transmit logs to the slave Database
# Define archiving to the slave database, force archiving, and retry time 60 seconds.
# If it is defined as an optional state (optional), archive will not be attempted again after the archive fails. Definition
# If the archiving fails after the status is madatory, the next log will be archived again.
SQL> alter system switch logfile;
System altered.
SQL>/
System altered.
SQL>
Observe logs on slave nodes
[Oracle @ eygle bdump] $ tail-f alert_primary.log
MRP0: Background Managed Standby Recovery process started
Starting datafile 1 recovery in thread 1 sequence 90
Datafile 1: '/opt/oracle/oradata/primary/system01.dbf'
Starting datafile 2 recovery in thread 1 sequence 90
Datafile 2: '/opt/oracle/oradata/primary/undotbs01.dbf'
..............................
-Bash-2.05b $ mkdir/home/oracle/oradata/oracle/stdarch
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.