Routine basic maintenance commands for Oracle RAC

Source: Internet
Author: User

 

Routine basic maintenance commands for Oracle RAC

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/keys of = votingdisk. bak # dd if =/dev/zero of =/dev/rdsk/c4t600c0ff00000098ade240330a000d0s4 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;

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/keys of = votingdisk. bak # dd if =/dev/zero of =/dev/rdsk/c4t600c0ff00000098ade240330a000d0s4 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;

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.