Management of Oracle Data Guard

Source: Internet
Author: User
Tags sessions

Dataguard closes state enable repository: Sql>startup Nomount; Sql>alter database mount standby database; Sql>alter database recover managed standby database disconnect from session; (synchronous but not real-time application log) Close standby: Sql>alter database Recover managed standby database cancel; Sql>shutdown immediate; Open from closed state: Sql>startup Nomount; Sql>alter database mount standby database; Sql>alter database open Read only; read-only opened from recovery state: sql>sql>sql>alter database recover managed  standby database using current logfile disconnect from session; (Sync and live Application log)  ------------------------------------------------------------------------main repository switchover: Main Library:sql> ALTER DATABASE commit to switchover to physical standby; Sql>shutdown immediate; Sql>startup Nomount; Sql>alter database mount standby database; Sql>alter database recover managed standby database disconnect from session; Prepare library: Sql>alter  database commit to SW Itchover to Primary; Sql>shutdown immediate; Sql>startUp,------------------------------------------------------------------  non-normal switch: (when the main library when the machine) to start the Fallover standby library:sql> ALTER DATABASE recover managed standby database finish; Sql>alter database commit to switchover to primary; Sql>shutdown immediate; sql>startup;-----------------------------------------------------------------Routine Maintenance commands:  querying database status:sql> Select Instance_name,status from v$instance;  querying the Master repository:sql> select Database_role from v$database;  Check the switchable state of the database: Sql>select switchover_status from v$database;  archive a log: Alter system switch logfile;  Whether the query archive log is applied:sql> select sequence#,dest_id,first_time,next_time,archived,applied from v$archived_log;  Check if the standby is synchronized with the main library:sql> select archived_thread#,archived_seq#,applied_thread#,applied_seq# from V$archive_dest_status;   Query Log shipping conditions:sql> SELECT * from v$archive_gap;  queries the current host run state:sql> select Switchover_status,database_role, Protection_mode from v$database;  View some process conditions and processes for the current repository idsql> select Process,status,thread#,sEquence#,block#,blocks from v$managed_standby;  View synchronization error condition:sql> Select error from v$archive_dest;  Verify the archived files that are passed:sql> select Sequence#,first_time,next_time,applied,completion_time from V$archived_log ORDER by sequence#;  the maximum number of archived files for the main repository is the same;sql> select DISTINCT Thread#,max (sequence#) over (partition by thread#) A from v$ archived_log; ------------------------------------------------------------------  Master repository switching:    Main Library: Check the switchable state of the database: Sql>select switchover_status from v$database;  if it is to standby it can switch normally, ALTER DATABASE Commit to switchover to physical standby, or sessions active, indicates that a session is currently active. ALTER DATABASE commit to switchover to physical standby with session shutdown; The library is modified to standby     Standby: Restart the main library shutdown immediate;startup mount;  Check the switchable state of the repository: select Switchover_status from v$database;  if it is to Primary can switch normally, alter  database commit to switchover to primary, if sessions  active: Alter  database & Nbsp;commit  to SwitchoveR  to Primary  with session shutdown; Run the complete fallback into the main library: -------------------------------------------------- --------------------Main Vault Open log: sql>show parameter Log_archive_dest_state_;alter system set log_archive_dest_state_2= Enable Scope=both;-------------------------------------------------------------------Open Standby Sql>alter database Recover managed Standby database using current logfile disconnect from session;alter database recover managed Standby data Base Cancel;alter Database open;alter database recover managed standby database using current logfile disconnect from Sess ion; --------------------------------------------------------------------------View the protected mode of the database: select Database_ Role,protection_mode,protection_level from V$database; maximum protection: write in the master library while ensuring that it is also written in the standby (MAXIMUM   PROTECTION) Maximum availability: Provides maximum protection data without affecting the main library (MAXIMUM  availability) maximum performance: not synchronous write, in the case of a good network environment, almost synchronous (MAXIMUM Performance)   Modify protection mode: Alter system set log_archive_dest_2= "Service=dg2 ASYNC valid_for= (online_logfiles,pRimary_role) db_unique_name=dg2 ";      1, query the number of connections to Oracle Select count (*)  from  V$SESSION;2, querying the number of concurrent connections for Oracle Select count (*)  from v$session where status= ' ACTIVE '; 3. View the number of connections for different users Select username,count (username)  from v$session where username is  not null group by username;4, view all users: Select * from all_users;5, To view user or role system permissions (System permissions that are directly assigned to a user or role): Select * from dba_sys_privs;select * from user_sys_ Privs;6, view roles (view only roles owned by logged-in users) Select * from role_sys_privs;7, view user object permissions:select *  From dba_tab_privs;select * from all_tab_privs;select * from user_tab_privs ; 8. View all roles: select * from dba_roles;9, view roles owned by user or role:select * from dba_role_privs; SELECT * FROM USER_ROLE_PRIVS;10, see which users have SYSDBA or Sysoper system permissions (requires appropriate permissions when querying) Select * from  v$pwfile_users;     

Management of Oracle Data guard

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.