熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

OracleRAC常用管理命令

2022-06-13   來源: Oracle 

   可以配置一些Oracle用到的變量

  export ORACLE_BASE=/u/app/oracle

  export ORACLE_HOME=/u/app/oracle/product//db_

  export ORACLE_SID=NEWRAC

  ORACLE_HOSTNAME=newrachqlumigentint

  export PATH=/u/app/oracle/product//db_/bin:$PATH

  export ORA_CRS_HOME=/u/app/crs/product//crs

  export PATH=/u/app/crs/product//crs/bin:$PATH

  export ORACLE_USER=orarac

     crsctl     檢查crs

  crsctl check crs    檢查crs狀態

  crsctl start crs     啟動crs

  crsctl stop crs

  crsctl check crsd

  crs_stat t

  等等其 /etc/initd/initcrs stop   /etc/initd/initcrsd stop    等開機啟動service 腳本如果

  如果你發現crs不能正常工作可以檢查調試一下這些腳本檢查一下進程是不是這個腳本可以正常工作

  crs的啟動log 在 $ORA_CRS_HOME/log    $ORA_CRS_HOME/log/client 下面可以找到出現錯誤可以檢查一下對應的log

   srvctl 啟動數據庫與實例

  srvctl start database d NEWRAC 啟動名字為NEWRAC的數據庫

  查看當前數據庫的狀態

  [root@newrac ~]# srvctl status database d NEWRAC

  Instance NEWRAC is running on node newrac

  Instance NEWRAC is running on node newrac

  srvctl start instance d NEWRAC   i newrac 啟動某一個實例

  檢查rac的配置文件 可以在裡面找到數據庫的名字等

  /u/oradata/NEWRAC/spfileNEWRACora

  /u/app/oracle/admin/NEWRAC/pfile/initora

  另附網絡上找到的幾篇文章

  Daytoday management of Oracle G RAC   原文地址

  ==================================================

  Daytoday management of Oracle G RAC

  CRS management

  rnCRSCTL command control of the CRS Services local node (Oracle clusterware processes)

  rn stop CRS:

  rn $ crsctl stop crs or

  rn $ / etc / initcrs stop or

  rn $ crs_stopall

  rn start CRS:

  rn $ crsctl start crs or

  rn $ / etc / initcrs start

  rn prohibited Clusterware restart automatically at system startup methods:

  rn $ / etc / initcrs disable

  rn start Clusterware restart automatically at system startup methods:

  rn $ / etc / initcrs enable

  rn view the status CRS Services

  rn $ crsctl check crs

  rnOCR resource management

  rnOCR resources when the RAC cluster up and running successfully you can use the instrument crs_stat see the following:

  rn $ ORA_CRS_HOME / bin / crs_stat

  rn general the status of all resources should be online In addition OCR will be four hours each to back up first Have some cases you can restore the OCR configuration file to restore problems OCR

  rn such as the use of the following situations occur:

  rn $ crs_statt

  rnCRS: Cannot communicate with the CRS daemon

  rn $ crsctl check boot

  rnFailure at procr_open_key with status

  rnPROC: The cluster registry key to be operated on does not exist

  rn $ crsctl check crs

  rnFailure contacting CSS daemon

  rnCannot communicate with CRS

  rnCannot communicate with EVM

  rn caused this error may be due to a lost OCR configuration We can use this backup to restore the previous configuration

  rn # / etc / initcrs disable

  rn # / etc / initcrs stop

  rn before the crs process to ensure that all stopped

  rn # su oracle

  rn $ cd $ ORA_CRS_HOME / bin

  rn $ / ocrconfigrestore / opt / app / oracle / crs / cdata / crs / weekocr

  rn then switch to the root user the reenable CRS

  rn # / etc / initcrs enable

  Finally reboot both node rn

  Introduction rnSRVCTL order

  rnSRVCTL order to control the RAC database instance listener as well as services

  rn at SRVCTL usually carried out under ORACLE user Us to introduce the following command srvctl

  rn through SRVCTL command to start / stop / check all of the examples:

  rn $ srvctl start | stop | status databased

  rn start / stop the specified instance:

  rn $ srvctl start | stop | status instancedi

  rn list all of the current RAC

  rn $ srvctl config databased

  rn start / stop / check all nodeapps such as: VIP GSD listener ONS:

  rn $ srvctl start | stop | status nodeappsn

  rn if you use ASM srvctl can also start / stop ASM instance:

  rn $ srvctl start | stop asmn [i] [o]

  rn access to all environmental information:

  rn $ srvctl getenv databased [i]

  rn set the overall environment and the variables:

  rn $ srvctl setenv databasedt LANG = en

  rn have been deleted from the OCR databases:

  rn $ srvctl remove databased

  rn to the OCR to add a database:

  rn $ srvctl add databasedo

  rn [m] [p] [A / netmask] [r (PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY)] [s]

  rn to the OCR to add a database instance:

  rn $ srvctl add instancedin

  rn $ srvctl add instancedin

  rn to the OCR Add a ASM instance:

  rn $ srvctl add asmnio

  rn add a service

  rn $ srvctl add servicedsr [a] [P] [u]

  rn modified on other nodes in the service

  rn $ srvctl modify servicedsIt

  rn relocate a service node to other nodes

  rnsrvctl relocate servicedsI

  and related services rnCRS common command demo

  rn view order status

  rn # suoracle to switch to the oracle user

  rn $ crs_statt check crs and all of the service status

  rn $ crsctl check crs use crsctl order to check the status of related services crs

  rn $ srvctl status nodeappsn db (db) use srvctl to view the services on all nodes and whether it is normal

  rn $ srvctl status databased db the database using srvctl status view

  rn turn off startup and related services in order

  rn # su oracle

  rn $ crs_startall start all crs Service

  rn $ crs_stopall to stop all of the Services crs

  rn $ crsctl start crs Services start crs

  rn $ crsctl stop crs stop crs Service

  rn $ srvctl start nodeappsn db (db) Start a node on the application of all

  rn $ srvctl stop nodeappsn db (db) stop a node on the application of all

  rn $ srvctl start listenern db (db) Start a node listener

  rn $ srvctl stop listenern db (db) The listener to stop a node

  rn $ srvctl start instanced dbi db (db) start an instance

  rn $ srvctl stop instanced dbi db (db) to stop a particular instance

  rn $ srvctl start databased db startup database

  rn $ srvctl stop databased db to stop the database

  =========================================================

  RAC common command description 原文地址

  oracle rac database of commonly used commands:

   The state of all instances and services

  srvclt status databased orcl

  A single instance of state:

  srvctl status instanced orcli orcl/orcl

  Global names in the database status of the service:

  srvctl status serviced orcls orcltest

  Applicationspecific node state:

  srvctl status nodeappsn linux

  srvctl status nodeappsn linux

  ASM instance state

  srvctl status asmn linux

  Lists all database configuration:

  srvctl config database

  Display RAC database configuration information:

  srvctl config databased orcl

  Show all services specified cluster database

  srvctl config serviced orcl

  Display node application configuration information (VIP GSD ONS Listener etc)

  srvctl config nodeappsn linuxagsl

  Shows the configuration of ASM instance

  srvctl config asmn linux

  Cluster all running instances:

  select

  inst_id instance_number inst_no instance_name is inst_name

  parallel status database_status db_status

  active_state state host_name host from gv $ instance

  order by inst_id;

  In the disk group all data files:

  select name from v $ datafile

  union

  select member from v $ logfile

  union

  select name from v $ controlfile

  union

  select name from v $ tempfile;

  Start and stop RAC databases:

  su oracle

  hostname

  Stop oracle rac g environment:

  The first step: stop oracle instance when this instance (and related services) closed shut down ASM instances and finally close the node applications (Virtual IP GSD TNS Listener and ONS)

  export oracle_sid = orcl

  emctl stop dbconsole

  srvclt stop instanced orcli orcl

  srvctl stop asmn rac

  srvctl stop nodeappsn rac

  Start RAC environment:

  The first step is to start the node applications (Virtual IP GSD TNS listener and ONS

  ) When the successful launch of the node application start the ASM instance and finally start the ORACLE instance (and related services) and Enterprise Manager Database console

  export oracle_sid = orcl

  srvctl start nodeappsn rac

  srvctl start asmn rac

  srvctl start instanced orcli orcl

  emctl start dbconsole

  Practical srvclt start to stop all instances of:

  srvclt start databased orcl

  srvctl stop databased orcl

  Start stop the listener:

  lsnrctl start listener_hostb

  lsnrctl stop listener

  **************************************************

  ************************************************** ************************

  Oracle G R RAC daily management

  CRS management

  CRSCTL command controls the local nodes CRS services (Oracle clusterware processes)

  Stop CRS:

  $ Crsctl stop crs or

  $ / Etc / initcrs stop or

  $ Crs_stopall

  Start CRS:

  $ Crsctl start crs or

  $ / Etc / initcrs start

  Prohibition Clusterware restart automatically after system start method:

  $ / Etc / initcrs disable

  Start Clusterware automatically start after reboot the system approach:

  $ / Etc / initcrs enable

  See CRS service status

  $ Crsctl check crs

  OCR resource management

  OCR resources when the RAC cluster up and running after success you can use crs_stat tools see the following:

  $ ORA_CRS_HOME / bin / crs_stat

  Typically the state of all resources should be online In addition OCR will backup every hours once In some cases you can restore the OCR configuration file to restore the problem of OCR

  Such as use of the following situations occur:

  $ Crs_statt

  CRS: Cannot communicate with the CRS daemon

  $ Crsctl check boot

  Failure at procr_open_key with status

  PROC: The cluster registry key to be operated on does not exist

  $ Crsctl check crs

  Failure contacting CSS daemon

  Cannot communicate with CRS

  Cannot communicate with EVM

  A possible cause of this error because the OCR configuration lost We can use this backup to restore the previous configuration

  # / Etc / initcrs disable

  # / Etc / initcrs stop

  First ensure that all of the crs process all the stops

  # Su oracle

  $ Cd $ ORA_CRS_HOME / bin

  $ / Ocrconfigrestore / opt / app / oracle / crs / cdata / crs / weekocr

  Then switch to the root user the reenable CRS

  # / Etc / initcrs enable

  Finally reboot the two nodes

  SRVCTL command description

  SRVCTL command can control the RAC database instance listener and services

  Usually SRVCTL executed in the ORACLE user Heres a srvctl command

   by SRVCTL command to start / stop / check all of the examples:

  $ Srvctl start | stop | status databased <db_name>

   start / stop the specified instance:

  $ Srvctl start | stop | status instanced <db_name>i <instance_name>

   lists all the current RAC under

  $ Srvctl config databased <db_name>

   start / stop / check all the nodeapps such as: VIP GSD listener ONS:

  $ Srvctl start | stop | status nodeappsn <node_name>

   if you use ASM srvctl can also start / stop ASM instance:

  $ Srvctl start | stop asmn <node_name> [i <asm_inst_name>] [o <oracle_home>]

   can get all of the environmental information:

  $ Srvctl getenv databased <db_name> [i <instance_name>]

   set the global environment and the variables:

  $ Srvctl setenv databased <db_name>t LANG = en

   to remove from the existing OCR databases:

  $ Srvctl remove databased <db_name>

   add a database to OCR:

  $ Srvctl add databased <db_name>o <oracle_home>

  [M <domain_name>] [p <spfile>] [A <name|ip> / netmask] [r (PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY)] [s <start_options>]

   to the OCR to add a database instance:

  $ Srvctl add instanced <db_name>i <instance_name>n <node>

  $ Srvctl add instanced <db_name>i <instance_name>n <node>

   to add an OCR ASM instance:

  $ Srvctl add asmn <node_name>i <asm_inst_name>o <oracle_home>

   add a service

  $ Srvctl add serviced <db_name>s <service_name>r <preferred_list> [a <available_list>] [P <TAF_policy>] [u]

   modify the service to other nodes

  $ Srvctl modify serviced <db_name>s <service_name>I <orig_instance_name>t <target_instance_name>

   relocate to a service node to other nodes

  srvctl relocate serviced <db_name>s <service_name>I

  CRS and related services a demonstration of common commands

   view the status of the command

  # Suoracle first switch to the oracle user

  $ Crs_statt View crs and all the service of the state

  $ Crsctl check crs use crsctl command to check the status of related services crs

  $ Srvctl status nodeappsn db (db) use the srvctl view the services on all nodes are normal

  $ Srvctl status databased db the database using srvctl view the status of startup and shutdown commands related services

  # Su oracle

  $ Crs_startall start all the crs service

  $ Crs_stopall to stop all the crs service

  $ Crsctl start crs starts crs Service

  $ Crsctl stop crs stop crs service

  $ Srvctl start nodeappsn db (db) start all applications in a node

  $ Srvctl stop nodeappsn db (db) Stop all applications on a node

  $ Srvctl start listenern db (db) Start a node listener

  $ Srvctl stop listenern db (db) The listener to stop a node

  $ Srvctl start instanced dbi db (db) start an instance

  $ Srvctl stop instanced dbi db (db) stop an instance

  $ Srvctl start databased db Startup Database

  $ Srvctl stop databased db Stop database

  ===================================================================


From:http://tw.wingwit.com/Article/program/Oracle/201311/17756.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.