Oracle RAC basic maintenance commands

Source: Internet
Author: User
Tags cdata

Status of all instances and services

$ Srvctl status database-D orcl
Instance orcl1 is running on node linux1
Instance orcl2 is running on node linux2

Status of a single instance

$ Srvctl status instance-D orcl-I orcl2
Instance orcl2 is running on node linux2

 

The status of the global Naming Service in the database

$ Srvctl Status Service-D orcl-s orcltest
Service orcltest is running on instance (s) orcl2, orcl1

 

Node applications on specific nodesProgramStatus

$ Srvctl status nodeapps-N linux1
VIP is running on node: linux1
GSD is running on node: linux1
Listener is running on node: linux1
ONS daemon is running on node: linux1

 

ASM instance status

$ Srvctl status ASM-N linux1
ASM instance + ASM1 is running on node linux1.

 

List all configured Databases

$ Srvctl config Database
Orcl

 

Displays the configuration of the RAC database.

$ Srvctl config database-D orcl
Linux1 orcl1/u01/APP/Oracle/product/10.2.0/db_1
Linux2 orcl2/u01/APP/Oracle/product/10.2.0/db_1

 

Display all services of the specified cluster Database

$ Srvctl config service-D orcl
Orcltest Pref: orcl2 orcl1 avail:

 

Display node application configurations (VIP, GSD, ONS, listener)

$ Srvctl config nodeapps-N linux1-a-g-S-l
VIP exists.:/linux1-vip/192.168.1.200/255.255.255.0/eth0: eth1
GSD exists.
ONS daemon exists.
Listener exists.

 

Displays the configuration of the ASM instance.

$ Srvctl config ASM-N linux1
+ ASM1/u01/APP/Oracle/product/10.2.0/db_1

 

All running instances in the Cluster

Select
Inst_id
, Instance_number inst_no
, Instance_name inst_name
, Parallel
, Status
, Database_status db_status
, Active_state state
, Host_name host
From GV $ instance
Order by inst_id;

Inst_id inst_no inst_name par status db_status State host
----------------------------------------------------------------
1 1 orcl1 Yes open active normal Rac1
2 2 orcl2 Yes open active normal rac2

 

All data files in the disk group

Select name from V $ datafile
Union
Select member from V $ logfile
Union
Select name from V $ controlfile
Union
Select name from V $ tempfile;

Name
-------------------------------------------
+ Flash_recovery_area/orcl/controlfile/current.258.570913191
+ Flash_recovery_area/orcl/onlinelog/group_1.257.570913201
+ Flash_recovery_area/orcl/onlinelog/group_2.256.570913211
+ Flash_recovery_area/orcl/onlinelog/group_3.259.570918285
+ Flash_recovery_area/orcl/onlinelog/group_4.260.570918295
+ Orcl_data1/orcl/controlfile/current.259.570913189
+ Orcl_data1/orcl/datafile/example.257.570913311
+ Orcl_data1/orcl/datafile/indx.270.570920045
+ Orcl_data1/orcl/datafile/sysaux.260.570913287
+ Orcl_data1/orcl/datafile/system.262.570913215
+ Orcl_data1/orcl/datafile/undotbs1.261.570913263
+ Orcl_data1/orcl/datafile/undotbs1.271.570920865
+ Orcl_data1/orcl/datafile/undotbs2.265.570913331
+ Orcl_data1/orcl/datafile/undotbs2.272.570921065
+ Orcl_data1/orcl/datafile/users.264.570913355
+ Orcl_data1/orcl/datafile/users.269.570919829
+ Orcl_data1/orcl/onlinelog/group_1.256.570913195
+ Orcl_data1/orcl/onlinelog/group_2.263.570913205
+ Orcl_data1/orcl/onlinelog/group_3.266.570918279
+ Orcl_data1/orcl/onlinelog/group_4.267.570918289
+ Orcl_data1/orcl/tempfile/temp.258.570913303

21 rows selected.

 

All ASM disks belonging to the "orcl_data1" disk group

Select path
From v $ asm_disk
Where group_number in (select group_number
From v $ asm_diskgroup
Where name = 'orcl _ data1 ');

Path
----------------------------------
Orcl: vol1
Orcl: vol2

 

Start/stop a RAC cluster

Make sure that you log on with an oracle UNIX user. We will run all the commands from the Rac1 node:

# Su-Oracle

$ Hostname

Rac1

Stop Oracle RAC 10g environment

The first step is to stop the Oracle instance. When this instance (and related services) is closed, the ASM instance is closed. Finally, close the node application (virtual IP, GSD, TNS Listener, and ONS ).

$ Export oracle_sid = orcl1
$ Emctl stop dbconsole
$ Srvctl stop instance-D orcl-I orcl1
$ Srvctl stop ASM-N Rac1
$ Srvctl stop nodeapps-N Rac1

 

Start the Oracle RAC 10g environment

The first step is to start the node application (virtual IP, GSD, TNS Listener, and ONS ). After the node application is successfully started, start the ASM instance. Finally, start the Oracle instance (and related services) and the Enterprise Manager Database Console.

$ Export oracle_sid = orcl1
$ Srvctl start nodeapps-N Rac1
$ Srvctl start ASM-N Rac1
$ Srvctl start instance-D orcl-I orcl1
$ Emctl start dbconsole
 

Start/stop all instances using srvctl

Start/stop all instances and Their enabled services. I just added this step as a method to close all instances if I found it interesting!

$ Srvctl start database-D orcl
$ Srvctl stop database-D orcl

 

 

Enable and stop a listener
Hostb $ LSNRCTL start listener_hostb
Hostb $ LSNRCTL stop listener_hostb backup votning diskdd if = voting_disk_name of = backup_file_name
Dd If =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4
Of = votingdisk. Bak # dd If =/dev/zero
Of =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4 BS = 512 COUNT = 261120
Test
# Dd If =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4 of =/data/backup/RAC/vd_backup040000bak
261120 + 0 records
261120 + 0 record recall
# Cd/data/backup/RAC
# Ls
Ocr041_bak ocrdisk vd_backup041_bak votingdisk. Bak votingdisk041_bak
# Dd If =/data/backup/RAC/vd_backup041_bak of =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4
261120 + 0 records
261120 + 0 records recall backup OCR Disk
View backups
$ Ocrconfig-showbackup
Backup
/Data/Oracle/CRS/bin/ocrconfig-export/data/backup/RAC/ocrdisk. Bak
Restore all nodes that need to be stopped, stop the Oracle clusterware software on all of the nodes
/Data/Oracle/CRS/bin/ocrconfig-import file_name
Automatic backup restoration #/data/Oracle/CRS/bin/ocrconfig-showbackup
#/Data/Oracle/CRS/bin/ocrconfig-Restore/data/Oracle/CRS/CDATA/db168crs/backup00.ocrhosta $ cluvfy comp OCR-n all // check
OCR check
# The ocrcheck configuration path is in
If you need to change the path configuration of the OCR disk in the/var/opt/Oracle/ocrconfig_loc file.
OCR disk space check
#/Data/Oracle/CRS/bin/ocrcheck
Status of Oracle cluster registry is as follows:
Version: 2
Total Space (Kbytes): 399752
Used space (Kbytes): 3784
Available space (Kbytes): 395968
ID: 148562961
Device/File Name:/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s5
Device/file integrity check
Succeeded device/file not
Configured cluster registry integrity check succeeded #

ASM instance status
Hosta $ srvctl status ASM-N Hosta
The ASM instance and ASM1 are running on the node Hosta.
Hosta $ status of node applications on a specific node
Hosta $ srvctl status nodeapps-N Hosta
VIP node running: Hosta
GSD running node: Hosta
The listener is not running on the node: Hosta
The ONS daemon is running on the node: Hosta
Hosta $ status of all instances and services
Hosta $ srvctl status database-D Cole
Instance cole1 is running on node Hosta
Instance cole2 is running on node hostb
Hosta $ list all configured Databases
Hosta $ srvctl config Database
Cole
Hosta $
Show the configuration Hosta $ srvctl config database-D Cole of the RAC Database
Hosta cole1/data/Oracle/oraclehome
Hostb cole2/data/Oracle/oraclehome
Hosta $ display the configuration of the ASM instance
Hosta $ srvctl config ASM-N Hosta
+ ASM1/data/Oracle/oraclehome display node application configuration-(VIP, GSD, ONS, listener)
Hosta $ srvctl config nodeapps-N Hosta-a-g-S-l
VIP already exists. :/A1-vip/10.1.1.9/255.255.255.0.0/ce0
GSD already exists.
The ONS daemon already exists.
The listener already exists.
Hosta $
All running instances in the Cluster
Select
Inst_id
, Instance_number inst_no
, Instance_name inst_name
, Parallel
, Status
, Database_status db_status
, Active_state state
, Host_name host
From GV $ instance
Order by inst_id; inst_id inst_no inst_name par status db_status State host
------------------------------------------------------------------------------
1 1 cole1 Yes open active
Normal Hosta 2 2 cole2 Yes open
Active normal hostb

All data files in the disk group
SQL> select name from V $ datafile
Union
Select member from V $ logfile
Union
Select name from V $ controlfile
Union
Select name from V $ tempfile;

From: http://www.cnblogs.com/rootq/archive/2009/01/14/1375655.html

Status of all instances and services

$ Srvctl status database-D orcl
Instance orcl1 is running on node linux1
Instance orcl2 is running on node linux2

Status of a single instance

$ Srvctl status instance-D orcl-I orcl2
Instance orcl2 is running on node linux2

 

The status of the global Naming Service in the database

$ Srvctl Status Service-D orcl-s orcltest
Service orcltest is running on instance (s) orcl2, orcl1

 

Node application status on a specific node

$ Srvctl status nodeapps-N linux1
VIP is running on node: linux1
GSD is running on node: linux1
Listener is running on node: linux1
ONS daemon is running on node: linux1

 

ASM instance status

$ Srvctl status ASM-N linux1
ASM instance + ASM1 is running on node linux1.

 

List all configured Databases

$ Srvctl config Database
Orcl

 

Displays the configuration of the RAC database.

$ Srvctl config database-D orcl
Linux1 orcl1/u01/APP/Oracle/product/10.2.0/db_1
Linux2 orcl2/u01/APP/Oracle/product/10.2.0/db_1

 

Display all services of the specified cluster Database

$ Srvctl config service-D orcl
Orcltest Pref: orcl2 orcl1 avail:

 

Display node application configurations (VIP, GSD, ONS, listener)

$ Srvctl config nodeapps-N linux1-a-g-S-l
VIP exists.:/linux1-vip/192.168.1.200/255.255.255.0/eth0: eth1
GSD exists.
ONS daemon exists.
Listener exists.

 

Displays the configuration of the ASM instance.

$ Srvctl config ASM-N linux1
+ ASM1/u01/APP/Oracle/product/10.2.0/db_1

 

All running instances in the Cluster

Select
Inst_id
, Instance_number inst_no
, Instance_name inst_name
, Parallel
, Status
, Database_status db_status
, Active_state state
, Host_name host
From GV $ instance
Order by inst_id;

Inst_id inst_no inst_name par status db_status State host
----------------------------------------------------------------
1 1 orcl1 Yes open active normal Rac1
2 2 orcl2 Yes open active normal rac2

 

All data files in the disk group

Select name from V $ datafile
Union
Select member from V $ logfile
Union
Select name from V $ controlfile
Union
Select name from V $ tempfile;

Name
-------------------------------------------
+ Flash_recovery_area/orcl/controlfile/current.258.570913191
+ Flash_recovery_area/orcl/onlinelog/group_1.257.570913201
+ Flash_recovery_area/orcl/onlinelog/group_2.256.570913211
+ Flash_recovery_area/orcl/onlinelog/group_3.259.570918285
+ Flash_recovery_area/orcl/onlinelog/group_4.260.570918295
+ Orcl_data1/orcl/controlfile/current.259.570913189
+ Orcl_data1/orcl/datafile/example.257.570913311
+ Orcl_data1/orcl/datafile/indx.270.570920045
+ Orcl_data1/orcl/datafile/sysaux.260.570913287
+ Orcl_data1/orcl/datafile/system.262.570913215
+ Orcl_data1/orcl/datafile/undotbs1.261.570913263
+ Orcl_data1/orcl/datafile/undotbs1.271.570920865
+ Orcl_data1/orcl/datafile/undotbs2.265.570913331
+ Orcl_data1/orcl/datafile/undotbs2.272.570921065
+ Orcl_data1/orcl/datafile/users.264.570913355
+ Orcl_data1/orcl/datafile/users.269.570919829
+ Orcl_data1/orcl/onlinelog/group_1.256.570913195
+ Orcl_data1/orcl/onlinelog/group_2.263.570913205
+ Orcl_data1/orcl/onlinelog/group_3.266.570918279
+ Orcl_data1/orcl/onlinelog/group_4.267.570918289
+ Orcl_data1/orcl/tempfile/temp.258.570913303

21 rows selected.

 

All ASM disks belonging to the "orcl_data1" disk group

Select path
From v $ asm_disk
Where group_number in (select group_number
From v $ asm_diskgroup
Where name = 'orcl _ data1 ');

Path
----------------------------------
Orcl: vol1
Orcl: vol2

 

Start/stop a RAC cluster

Make sure that you log on with an oracle UNIX user. We will run all the commands from the Rac1 node:

# Su-Oracle

$ Hostname

Rac1

Stop Oracle RAC 10g environment

The first step is to stop the Oracle instance. When this instance (and related services) is closed, the ASM instance is closed. Finally, close the node application (virtual IP, GSD, TNS Listener, and ONS ).

$ Export oracle_sid = orcl1
$ Emctl stop dbconsole
$ Srvctl stop instance-D orcl-I orcl1
$ Srvctl stop ASM-N Rac1
$ Srvctl stop nodeapps-N Rac1

 

Start the Oracle RAC 10g environment

The first step is to start the node application (virtual IP, GSD, TNS Listener, and ONS ). After the node application is successfully started, start the ASM instance. Finally, start the Oracle instance (and related services) and the Enterprise Manager Database Console.

$ Export oracle_sid = orcl1
$ Srvctl start nodeapps-N Rac1
$ Srvctl start ASM-N Rac1
$ Srvctl start instance-D orcl-I orcl1
$ Emctl start dbconsole
 

Start/stop all instances using srvctl

Start/stop all instances and Their enabled services. I just added this step as a method to close all instances if I found it interesting!

$ Srvctl start database-D orcl
$ Srvctl stop database-D orcl

 

 

Enable and stop a listener
Hostb $ LSNRCTL start listener_hostb
Hostb $ LSNRCTL stop listener_hostb backup votning diskdd if = voting_disk_name of = backup_file_name
Dd If =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4
Of = votingdisk. Bak # dd If =/dev/zero
Of =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4 BS = 512 COUNT = 261120
Test
# Dd If =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4 of =/data/backup/RAC/vd_backup040000bak
261120 + 0 records
261120 + 0 record recall
# Cd/data/backup/RAC
# Ls
Ocr041_bak ocrdisk vd_backup041_bak votingdisk. Bak votingdisk041_bak
# Dd If =/data/backup/RAC/vd_backup041_bak of =/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s4
261120 + 0 records
261120 + 0 records recall backup OCR Disk
View backups
$ Ocrconfig-showbackup
Backup
/Data/Oracle/CRS/bin/ocrconfig-export/data/backup/RAC/ocrdisk. Bak
Restore all nodes that need to be stopped, stop the Oracle clusterware software on all of the nodes
/Data/Oracle/CRS/bin/ocrconfig-import file_name
Automatic backup restoration #/data/Oracle/CRS/bin/ocrconfig-showbackup
#/Data/Oracle/CRS/bin/ocrconfig-Restore/data/Oracle/CRS/CDATA/db168crs/backup00.ocrhosta $ cluvfy comp OCR-n all // check
OCR check
# The ocrcheck configuration path is in
If you need to change the path configuration of the OCR disk in the/var/opt/Oracle/ocrconfig_loc file.
OCR disk space check
#/Data/Oracle/CRS/bin/ocrcheck
Status of Oracle cluster registry is as follows:
Version: 2
Total Space (Kbytes): 399752
Used space (Kbytes): 3784
Available space (Kbytes): 395968
ID: 148562961
Device/File Name:/dev/rdsk/c4t600c0ff000000000098ade240330a000d0s5
Device/file integrity check
Succeeded device/file not
Configured cluster registry integrity check succeeded #

ASM instance status
Hosta $ srvctl status ASM-N Hosta
The ASM instance and ASM1 are running on the node Hosta.
Hosta $ status of node applications on a specific node
Hosta $ srvctl status nodeapps-N Hosta
VIP node running: Hosta
GSD running node: Hosta
The listener is not running on the node: Hosta
The ONS daemon is running on the node: Hosta
Hosta $ status of all instances and services
Hosta $ srvctl status database-D Cole
Instance cole1 is running on node Hosta
Instance cole2 is running on node hostb
Hosta $ list all configured Databases
Hosta $ srvctl config Database
Cole
Hosta $
Show the configuration Hosta $ srvctl config database-D Cole of the RAC Database
Hosta cole1/data/Oracle/oraclehome
Hostb cole2/data/Oracle/oraclehome
Hosta $ display the configuration of the ASM instance
Hosta $ srvctl config ASM-N Hosta
+ ASM1/data/Oracle/oraclehome display node application configuration-(VIP, GSD, ONS, listener)
Hosta $ srvctl config nodeapps-N Hosta-a-g-S-l
VIP already exists. :/A1-vip/10.1.1.9/255.255.255.0.0/ce0
GSD already exists.
The ONS daemon already exists.
The listener already exists.
Hosta $
All running instances in the Cluster
Select
Inst_id
, Instance_number inst_no
, Instance_name inst_name
, Parallel
, Status
, Database_status db_status
, Active_state state
, Host_name host
From GV $ instance
Order by inst_id; inst_id inst_no inst_name par status db_status State host
------------------------------------------------------------------------------
1 1 cole1 Yes open active
Normal Hosta 2 2 cole2 Yes open
Active normal hostb

All data files in the disk group
SQL> select name from V $ datafile
Union
Select member from V $ logfile
Union
Select name from V $ controlfile
Union
Select name from V $ tempfile;

From: http://www.cnblogs.com/rootq/archive/2009/01/14/1375655.html

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.