DB CONTROL的重建

以前弄个10gR2的,今天竟然遇到了10gR1的情况,emca命令在这两个版本见的差异也太大了,把文档记录下

How to recreate the DBSNMP user in a 10g database? [ID 762393.1]
1. Drop any leftovers from the DBSNMP user:
SQL> @?/rdbms/admin/catnsnmp.sql
2. Create the DBSNMP user:
SQL> @?/rdbms/admin/catsnmp.sql

How To Drop, Create And Recreate DB Control In A 10g Database [ID 278100.1]

DB Control options:


A.  Delete DB Control Objects:

Option 1.  Delete DB Control Configuration Files using EMCA scripts
Option 2.  Delete DB Control Configuration Files Manually:
Option 3.  Delete DB Control Repository Objects using RepManager
Option 4.  Delete DB Control Repository Objects Manually
Option 5.  Delete DB Control Configuration Files and Repository Objects using EMCA

Option 1. Delete DB Control Configuration Files using EMCA scripts:
For DB Control 10.1.x, run the command: /bin/emca -x 
For DB Control 10.2.x, run the command: bin/emca -deconfig dbcontrol db

 

Important Note: the option -deconfig removes the EM jobs from Scheduling before the DB Control is deconfigured. Otherwise the repository, which is not dropped, could be corrupted or inconsistent if EM jobs were scheduled as the time the DB Control is dropped. It could also cause some errors during the DB Control deletion.


Option 2. Delete DB Control Configuration Files Manually:

Remove the following directories from your filesystem:
/
/oc4j/j2ee/OC4J_DBConsole__

If the dbcontrol is upgraded from lower version, for example, from
10.2.0.3 to 10.2.0.4, then the following directory also needs to be removed from the file system.
/.upgrade
/oc4j/j2ee/OC4J_DBConsole__.upgrade

NOTE: 
On Windows you also need to delete the DB Console service:
- run regedit
- navigate to HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services
- locate the OracleDBConsole entry and delete it

Alternatively on Windows XP and Windows Server 2003 you can run the following from the command line:
'sc delete '
- where is the DB Control service name (typically: OracleDBConsole)

OR use the command,

'nmesrvops delete '
- where is the DB Control service name (typically: OracleDBConsole)

Also available from Microsoft is the delsrv.exe command.   (Free download from Microsoft)


Option 3. Delete DB Control Repository using RepManager:
This option is not as complete as the other options.  You may find that dropping the repository using the commandline options is a better solution.  Also note, RepManager is not used to create a DB Control Repository.
In both 10g R1 and R2 run: 
/sysman/admin/emdrep/bin/RepManager -action drop

Warning: this command puts the database in Quiesce Mode.
Please consult the Note 375946.1 Running EMCA Results in Database quiesce And No
New Connections or Operations Can Be Performed During the DB Control Repository Creation


Option 4. Delete DB Control Repository Objects Manually
Step 1: Drop AQ related objects in the SYSMAN schema
Logon SQLPLUS as user SYS
SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);

Step 2: Drop the DB Control Repository Objects
Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and management objects:
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP RESTRICT;
SQL> EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
SQL> EXEC sysman.setEMUserContext('',5);
SQL> REVOKE dba FROM sysman;
SQL> DECLARE
CURSOR c1 IS
SELECT owner, synonym_name name
FROM dba_synonyms
WHERE table_owner = 'SYSMAN';
BEGIN
FOR r1 IN c1 LOOP
IF r1.owner = 'PUBLIC' THEN
EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
ELSE
EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
END IF;
END LOOP;
END;
/
SQL> DROP USER mgmt_view CASCADE;
SQL> DROP ROLE mgmt_user;
SQL> DROP USER sysman CASCADE;
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;
Note: The above will completely delete the DB Control repository from the database; under certain circumstances (e.g. you want to recreate the repository later on) the following statements may be sufficient to remove the repository:

Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and management objects:
SQL> drop user sysman cascade;
SQL> drop role MGMT_USER;
SQL> drop user MGMT_VIEW cascade;
SQL> drop public synonym MGMT_TARGET_BLACKOUTS;
SQL> drop public synonym SETEMVIEWUSERCONTEXT;

Option 5. Delete DB Control Configuration Files and Repository Objects using EMCA

For DB Control 10.1.x, dropping both the configuration files and the repository objects is a two step process.  Run the following two commands:
/bin/emca -x 
/sysman/admin/emdrep/bin/RepManager -action drop

For DB Control 10.2.x, both configuration files and repository objects can be deleted with a single command.  Run the command:
/bin/emca -deconfig dbcontrol db -repos drop

Warning: this command puts the database in Quiesce Mode.
Please consult the Note 375946.1 Running EMCA Results in Database quiesce And No
New Connections or Operations Can Be Performed During the DB Control Repository Creation

B. Create DB Control Objects

Option 1.  Create the DB Control Configuration Files
Option 2.  Create the DB Control Repository Objects and Configuration Files

Option 1.  Create the DB Control Configuration Files
To create only the DB Control configuration files, skipping the repository creation (this would be done for instance if you dropped only the files and left the repository in place):
For DB Control 10.1.x, run the command: /bin/emca -r
For DB Control 10.2.x, run the command: /bin/emca -config dbcontrol db


Option 2. Create the DB Control Repository Objects and Configuration Files
For DB Control 10.1.x, run the command: /bin/emca
For DB Control 10.2.x, run the command: bin/emca -config dbcontrol db -repos create

C.  Recreate/ReConfig DB Control

Option 1.  Recreate the DB Control Configuration Files only (leave Repository intact)
Option 2.  Recreate the DB Control Configuration Files and Repository

In 10.2, the EMCA commands can be used to reconfigure the existing installs without removing them first.

Option 1. Recreate the DB Control Configuration Files only (leave Repository intact):
For DB Control 10.2.x, run the command:
/bin/emca -config dbcontrol db

Option 2. Recreate the DB Control Configuration Files and Repository

For DB Control 10.2.x, run the command:
/bin/emca -config dbcontrol db -repos recreate

Warning: this command puts the database in Quiesce Mode.
Please consult the Note 375946.1 Running EMCA Results in Database quiesce And No
New Connections or Operations Can Be Performed During the DB Control Repository Creation

For additional information on EMCA commandline options, please see the Oracle Enterprise Manager 10g Advanced Configuration Guide or see Note.330130.1 Overview Of The EMCA Commands Available for DB Control 10.2

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8242091/viewspace-674464/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8242091/viewspace-674464/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值