9i Create the Standby database step

Source: Internet
Author: User
Tags character set copy insert log connect sql pack sqlplus
Created recently, the data Guard under Oracle 9i was tested to find that 9i is more convenient for standby
First sorted out, as follows:

Operating Environment: Windows Professional + serveice Pack 4
Database: Oracle 9201
Main Library Sid:pormals
From the library sid:pormals
Oracle installation adopts OMF structure

1. Master and slave operating system and same pack

2. Set up the database on the master-slave library, select Install software only

3. In the main library, through the DBCA to establish a database, in addition to the character set selection ZHS16GBK, all use the default method

4. Manually create the same directory as the main library from the library

5. Close the main library database, back up the data files to the library
Make sure you need to copy past data files and redo log
Sqlplus/nolog
Sql> Conn/as sysdba;
Sql> select file_name from Dba_data_files;
Determine the copy data file you want
Sql> Select member from V$logfile;
Make sure you want to copy the online date to the file
sql> shutdown immediate;
Copy all the files selected above to the corresponding directory from the library.

6. Open the main library database, modify the file mode (Oracle9i user action)
Create an archive directory manually C:\Oracle\Arch
Sqlplus/nolog
Sql> Conn/as sysdba;
Connected.
sql> startup Mount;
sql> ALTER DATABASE Archivelog;
Sql> archive log start;
sql> archive log list;
sql> ALTER DATABASE open;
Sql> alter system set log_archive_dest_1= ' Location=c:\oracle\arch ';
Sql> alter system set log_archive_format= '%t_%s.dbf ' scope=spfile;
Sql> alter system set LOG_ARCHIVE_START=TRUE Scope=spfile;
Restart the database for the changes to take effect
sql> shutdown immediate;
Viewing archive mode
Sql> Startup
sql> archive log list;

7. Making from the library control file on the main library
Sqlplus/nolog
Sql> Conn/as sysdba;
sql> ALTER DATABASE CREATE STANDBY controlfile as ' C:\Oracle\control01.ctl ';
Copy Main Library C:\oracle\control01.ctl to C:\oracle\oradata\poramals\ directory from library

8. Configure the main library Listener.ora and Tnsnames.ora files
You can configure or directly edit C:\oracle\ora92\network\admin\listener.ora and Tnsname.ora files with Net Manager
It is also the normal library that is configured to listen and connect to the main library (primary), the main library to the network service name from the library (standby)

9. Configure Listener.ora and Tnsnames.ora files from the library
You can configure or directly edit C:\oracle\ora92\network\admin\listener.ora and Tnsname.ora files with Net Manager
It is also normal for a network service name that is configured to listen and connect from the library to the main library (primary), directly from the library (standby)

10. Start the listener of master and slave library
Execute the following command on the master and slave library respectively
Lsnrctl start
See if the listener of the master and slave library starts normally

11 Check the master and slave library Tnsnames.ora configuration
Main Library tnsping Standby
From the Library tnsping primary
See if the service name is configured correctly, respectively to the master and slave libraries

12. Create pfile on the main library because the 9i defaults to use SPFile
Sqlplus/nolog
Sql> Conn/as sysdba;
Connected.
sql> create pfile= ' C:\oracle\ora92\database\initporamls.ora ' from SPFile;

13.copy just created the C:\oracle\ora92\database.ora\initpormals.ora to the corresponding directory from the library

14. Modify the Initpormals.ora file from the library just copy
Major modifications added:
Modify Control_files to make it conform to the actual path of your control file
Add to:
standby_archive_dest= ' Location=c:\oracle tarch '
Fal_server= ' PRIMARY '
Fal_client= ' STANDBY '
Standby_file_management= ' AUTO '
Where standby_file_management is not necessary, but for the back of the main library to add files, from the library can be automatically processed, plus this parameter to avoid trouble.
At the same time, set up a related archive log path from the library C:\oracle Tarch.

15.copy Main Library C:\oracle\ora92\database\pwdpormals.ora to the corresponding directory from the library
16. Create a Dos>oradim-new-sid pormals from the library instance name
17. Start from library
Sqlplus/nolog
sql> startup Nomount;
sql> ALTER database MOUNT STANDBY database;
will be placed from the library to standby mode
sql> ALTER database RECOVER MANAGED STANDBY database DISCONNECT from session;

18. Set up on the main library to archive from the library
Sql> alter system set log_archive_dest_2= ' Service=standby mandatory reopen=60 ';
sql> Select *from v$log;
Toggle Current Online Log
sql> alter system switch logfile;
sql> Select *from v$log;
View background log from library
C:\oracle\admin\pormals\bdump\pormals_arler.
To see if the current archive log has completed its normal recovery
This data guard configuration is complete.

19. Test
On the main library
Sql> create user test identified by password;
Sql> Grant Connect, resource to test;
Sql> conn test/password @primary;
Sql> CREATE TABLE Test (name VARCHAR2 (20));
sql> INSERT into test values (' Hi,data guard ');
Sql> commit;
Sql> Conn/as SYSDBA
sql> alter system switch logfile;

View from the library log
C:\oracle\admin\poramls\bdump\pormals_alert.ora
To see if the current archive log has completed its normal recovery

Read-only to open from the library to see if insert into test values (' Hi,data guard ');
On from the library
Sql> Conn/as sysdba;
sql> ALTER DATABASE recover managed standby database cancel;
Sql> ALTER DATABASE open read only;
Sql> Conn test/Password
Sql> select * from test;
See if INSERT into test values (' Hi,data guard ');
If the effective instructions are fully functional, the data guard is fully configured.
Reset from library in recovery mode
sql> ALTER database RECOVER MANAGED STANDBY database disconnect from session;
Note:
1. About starting off order
When starting, start from the listener of the library, and then start from the library, and then start the main library of the listener then the main library is closed when the reverse, first close the main library, and then from the library.
2. Some common view
V$archive_dest_status This will record the state of standby and revert to that log
V$archive_gap This will record the courage of the current recovery from the library MRP process has not been uploaded to the log from the library
V$archived_log This will record all the logs that have been archived to and from the library, and record whether the log has been recovered
V$database will record the protection status of the system and whether it is in the Force logging state
V$managed_standby (physical STANDBY Databases only) records the process IDs of some processes and processes currently from the library, such as RFS,MRP, etc.
V$standby_log (physical STANDBY Databases only) records some of the current STANDBY redo LOG from the library.



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.