Add database information to Srvctl Manager by srvctl add command-Go

Source: Internet
Author: User

This is a problem I have encountered in practice, the RAC+DG architecture cuts the repository to the primary library, and the Srvctl manager does not have database information.

For the database created by DBCA, the Srvctl contains information about the database and the instance. However, for backup-restored RAC databases, SRVCTL does not contain database and instance information.

The database information is not available in the Srvctl Manager and cannot be managed in many places using the Srvctl command. Therefore, you need to manually add the database information to the SRVCTL manager.

1. Create an experimental environment to implement the database information in the Srvctl manager.
--The original environment is database information
[Email protected] ~]$ crs_stat-t
Name Type Target State Host
------------------------------------------------------------
Ora. DATA.DG ora....up.type Online Online Rac1
Ora. FRA.DG ora....up.type Online Online Rac1
Ora .... Er.lsnr ora....er.type Online Online Rac1
Ora .... N1.lsnr ora....er.type Online Online Rac2
Ora .... DISK.DG ora....up.type Online Online Rac1
Ora.asm ora.asm.type Online Online Rac1
ORA.CVU ora.cvu.type Online Online Rac2
ORA.GSD Ora.gsd.type OFFLINE OFFLINE
Ora....network ora....rk.type Online Online Rac1
ora.oc4j ora.oc4j.type Online Online Rac1
Ora.ons ora.ons.type Online Online Rac1
Ora.rac.db ora....se.type Online Online Rac1 <-----------------
Ora .... Sm1.asm Application Online Online Rac1
Ora .... C1.lsnr Application Online Online Rac1
ORA.RAC1.GSD Application OFFLINE OFFLINE
Ora.rac1.ons Application Online Online Rac1
Ora.rac1.vip ora....t1.type Online Online Rac1
Ora .... Sm2.asm Application Online Online RAC2


Ora .... C2.lsnr Application Online Online RAC2
ORA.RAC2.GSD Application OFFLINE OFFLINE
Ora.rac2.ons Application Online Online RAC2
Ora.rac2.vip ora....t1.type Online Online Rac2
Ora.scan1.vip ora....ip.type Online Online Rac2

<1> Stop the database
Su-oracle
[Email protected] ~]$ srvctl stop database-d RAC

--db has stopped.
[[email protected] ~]$ Crs_stat-t|grep DB
Ora.rac.db Ora....se.type OFFLINE OFFLINE

<2> Delete Database information
[Email protected] ~]$ srvctl remove database-d RAC
Do you want to delete the database RAC? (Y/[n]) y

[[email protected] ~]$ Crs_stat-t|grep DB
--return empty, without database information

<3> start a database by startup
[Email protected] ~]$ Sqlplus/as SYSDBA
Sql*plus:release 11.2.0.3.0 Production on Wed Sep 18 12:59:51 2013
Copyright (c) 1982, Oracle. All rights reserved.
Connected to an idle instance.

Sql> Startup
ORACLE instance started.

Total System Global area 488534016 bytes
Fixed Size 2229624 bytes
Variable Size 276826760 bytes
Database buffers 205520896 bytes
Redo buffers 3956736 bytes
Database mounted.

<4>. To implement the purpose of missing database information
--srvctl command not available, Reason: Database information is missing
$ srvctl Status database-d RAC
PRCD-1120: Unable to find resource for database RAC.
PRCR-1001: Resource ora.rac.db does not exist

2. Adding database information and instance information via the Srvctl add command
Su-oracle
$ srvctl Add database-d rac-o/u01/app/oracle/11.2.0/db-p +data/rac/spfilerac.ora http://www.luyouqiwang.com/#-D db_ Unique_name; -O oracle_home; -P Spfile_path
$ srvctl Add instance-d rac-i rac1-n rac1 #-i instance_name;-n node_name

--Although database information has been added, the state of database is wrong
--crs_stat shows that the DB is not online and the actual db is started
$ crs_stat-t|grep db
Ora.rac.db Ora....se.type OFFLINE OFFLINE

[Email protected] ~]$ srvctl status database-d RAC
Instance Rac1 is not running on the RAC1 node


3. Start DB, Fix database information (feel more like register database information, because DB is actually started)
[Email protected] ~]$ srvctl start database-d RAC

--database information becomes normal
[Email protected] ~]$ crs_stat-t
Name Type Target State Host
------------------------------------------------------------
Ora. DATA.DG ora....up.type Online Online Rac1
Ora. FRA.DG ora....up.type Online Online Rac1
Ora .... Er.lsnr ora....er.type Online Online Rac1
Ora .... N1.lsnr ora....er.type Online Online Rac2
Ora .... DISK.DG ora....up.type Online Online Rac1


Ora.asm ora.asm.type Online Online Rac1
ORA.CVU ora.cvu.type Online Online Rac2
ORA.GSD Ora.gsd.type OFFLINE OFFLINE
Ora....network ora....rk.type Online Online Rac1
ora.oc4j ora.oc4j.type Online Online Rac1
Ora.ons ora.ons.type Online Online Rac1
Ora.rac.db ora....se.type Online Online Rac1 <---------------
Ora .... Sm1.asm Application Online Online Rac1
Ora .... C1.lsnr Application Online Online Rac1
ORA.RAC1.GSD Application OFFLINE OFFLINE
Ora.rac1.ons Application Online Online Rac1
Ora.rac1.vip ora....t1.type Online Online Rac1
Ora .... Sm2.asm Application Online Online RAC2
Ora .... C2.lsnr Application Online Online RAC2
ORA.RAC2.GSD Application OFFLINE OFFLINE
Ora.rac2.ons Application Online Online RAC2
Ora.rac2.vip ora....t1.type Online Online Rac2
Ora.scan1.vip ora....ip.type Online Online Rac2

[Email protected] ~]$ srvctl status database-d RAC
Instance Rac1 is running on node Rac1

This allows the database to be maintained using the SRVCTL command.

Viewing database configuration information with Srvctl
[Email protected] ~]$ srvctl config database-d rac-a
Database unique Name: RAC
Database name:
Oracle Home directory:/u01/app/oracle/11.2.0/db
Oracle User: Oracle
Spfile: +data/rac/spfilerac.ora
Domain:
Startup options: Open
Stop option: Immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RAC
DB instance: Rac1
Disk Group:
mount point Path:
Service:
Type: RAC
Database is enabled
The database is managed by the administrator

======
Add
======

Because the experimental key RAC has only one node left, the steps and commands are correct, but not very accurate.
The following is an accurate command to add database information and instance information.
$ srvctl Add database-d db_unique_name-o oracle_home e-m db_domain-p Spfile_path
$ srvctl Add instance-d db_unique_name-i instance_node1-n node_name1
$ srvctl Add instance-d db_unique_name-i instance_node2-n node_name1

If you use DBCA to build a library, DBCA automatically adds the database information to Srvctl Manager after the RAC database is created.

However, if you create a database manually, or restore a database by backing it up, you will need to add the database information manually.

two sets of RAC databases are installed on the current server, rac11g and Ractest, where Ractest is created through DBCA, and rac11g is restored by backup.

$ srvctl Status database-d rac11g
Prkr-1001:cluster database rac11g does not exist
Prko-2005:application error:failure in getting Cluster Database Configuration for:rac11g
$ srvctl Status database-d ractest
Instance Ractest1 is running on node Ser1
Instance Ractest2 is running on node Ser2

For the database created by DBCA, Srvctl contains information about the database and the instance, and the database and instance information is not included in Srvctl for the database rac11g of the backup recovery.

The database and instance information is added below through the Srvctl add command:

$ srvctl Add database-d rac11g-o/data/oracle/product/11.1/database-m us.oracle.com-p +data/rac11g/spfilerac11g.ora
$ srvctl Add instance-d rac11g-i rac11g1-n ser1
$ srvctl Add instance-d rac11g-i rac11g2-n ser2

Check the database status:

$ srvctl Status database-d rac11g
Instance RAC11G1 is not running on node Ser1
Instance Rac11g2 is not running on node Ser2

Database is not currently started, start the database with the Srvctl start command:

$ srvctl Start db-d rac11g
$ srvctl Status db-d rac11g
Instance RAC11G1 is running on node Ser1
Instance Rac11g2 is running on node Ser2

Now the RAC database rac11g can already be maintained through the SRVCTL command.

You can see the configuration information for an existing database using the SRVCTL Config command:

bash-3.00$ srvctl config database-d rac11g-a
Ser1 Rac11g1/data/oracle/product/11.1/database
Ser2 Rac11g2/data/oracle/product/11.1/database
db_unique_name:rac11g
Db_name:null
Oracle_home:/data/oracle/product/11.1/database
SPFILE: +data/rac11g/spfilerac11g.ora
DOMAIN:us.oracle.com
Db_role:null
Start_options:null
Policy:automatic
ENABLE flag:db ENABLED

http://blog.itpub.net/4227/viewspace-469962/

Add database information to Srvctl Manager by srvctl add command-Go

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.