时间:2021-07-01 10:21:17 帮助过:22人阅读
于是重新装了个系统,刚装好ORACLE数据库,又把OEM搞坏了,因为是Ghost的系统,觉得计算机名不好,于是换了个,之后OEM就挂了。从
这两天首先是把操作系统搞挂了,于是重新装了个系统,刚装好Oracle数据库,又把OEM搞坏了,因为是Ghost的系统,觉得计算机名不好,于是换了个,之后OEM就挂了。从网上了大半天也没搞定. 最终还是在oracle的metelink上找到了答案,20分钟就把OEM修好了。总结如下:
OEM重建出现的问题(很多类似的,浪费了N多时间):
2009-4-10 3:38:49 oracle.sysman.emcp.EMReposConfig createRepository
配置: ORA-01920:用户名'MGMT_VIEW'与另外一个用户名或角色名发生冲突
ORA-06512:在line 40
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-01920:用户名'MGMT_VIEW'与另外一个用户名或角色名发生冲突
ORA-06512:在line 40
2009-4-10 3:03:10 oracle.sysman.emcp.EMReposConfig unlockAccounts
配置: ORA-06550:第1行,第62列:
PLS-00201:必须声明标识符'SYSMAN.MGMT_VIEW_PRIV'
ORA-06550:第1行,第62列:
PL/SQL: Statement ignored
OEM常用的命令,及实例步骤.
创建一个EM资料库
emca -repos create
重建一个EM资料库
emca -repos recreate
删除一个EM资料库
emca -repos drop
配置数据库的Database Control
emca -config dbcontrol db
删除数据库的Database Control配置
emca -deconfig dbcontrol db
重新配置db control的端口,默认端口在1158
emca -reconfig ports
emca -reconfig ports -dbcontrol_http_port 1160
emca -reconfig ports -agent_port 3940
先设置ORACLE_SID环境变量后,启动EM console服务
emctl start dbconsole
先设置ORACLE_SID环境变量后,停止EM console服务
emctl stop dbconsole
先设置ORACLE_SID环境变量后,查看EM console服务的状态
emctl status dbconsole
配置dbconsole的步骤
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
重新配置dbconsole的步骤
emca -repos drop
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
-------------
手工重新配置dbconsole的步骤
1,修改DBSNMP密码:
重新配置DBCONSOLE,需要输入DBSNMP密码,但任何密码都会显示错误,需要预先修改。
sql>alter user dbsnmp identified by xxx;
2,删除早期DBCONSOLE创建的用户:
sql>drop role MGMT_USER;
sql>drop user MGMT_VIEW cascade;
sql>drop user sysman cascade;
3,,删除早期DBCONSOLE创建的对象:
sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
sql>drop public synonym SETEMVIEWUSERCONTEXT;
4,重新创建DBCONSOLE:(如果是在windows下,要先到注册表删除DBCONSOLE的服务,重启电脑)
$emca -config dbcontrol db -repos create
根据提示,先输入SID,再输入Y继续;
输入端口1521,输入SYS密码,输入DBSNMP密码,输入SYSMAN 密码,输入Y继续
完成。
-----------------------
FROM METALINK
422729.1 How to change the Hostname when Oracle10Gand ASM being useds
[url=https://metalink2.oracle.com/help/usaeng/Search/search.html#file: 422729.1]https://metalink2.oracle.com/help/usaeng/Search/search.html#file: 422729.1[/url] Type: HOWTO
Modified Date : 13-NOV-2008 Status:MODERATED
Applies to:
Oracle Server - Enterprise Edition - Version: 10.1 to 10.2
Information in this document applies to any platform.Goal
How to change the Hostname of the Windows when the10Gwith ASM being used
Solution
When changing the Hostname, 4 files would be affected.
1) Tnsnames.ora
2) listener.ora
3) Oraclecsservice
4) Enterprise Manager
** Note: AfterChanging the HostnameandBefore Starting the Services,please check the below **
1) Tnsnames.oraandListener.ora
** If theIpaddress is refered in these files,then there willnotbeany problem,elseyouneedtochangetheHostnamein theTnsnamesof theClientsconnecting to the server and theListeneron theServer
Tnsnames:
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) -- Tnsnames
Listener:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) >>>> in
Listener
)
)
Oraclecsservice
TheHostnamewill behard-codedin theCSService, so we need toRecreatethe Service
Steps to Recreate the CSService
Goto Oracle_Home/bin
Directory of L:/oracle/product/10.2.0/db10g/BIN
L:/oracle/product/10.2.0/db10g/BIN>localconfig delete
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
successfully deleted local CSS setup
L:/oracle/product/10.2.0/db10g/BIN>localconfig add
Step 1: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user '********', privgrp ''..
Operation successful.
Step 2: creating new CSS service
successfully created local CSS service
successfully added CSS to home
EM
If theHostnameis changed, then theEM Dbcontrol repositoryhas to berecreated. For this follow the below Note
https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=278100.1&blackframe=1How To Drop, Create And Recreate DB Control In A10gDatabase
References
[url=https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=278100.1&blackframe=1]https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=278100.1&blackframe=1[/url]- How To Drop, Create And Recreate DB Control In A10gDatabases
Subject:
How To Drop, Create And Recreate DB Control In A10gDatabase
[url=https://metalink2.oracle.com/help/usaeng/Search/search.html#file:278100.1]https://metalink2.oracle.com/help/usaeng/Search/search.html#file:278100.1[/url]
Type:BULLETIN Modified Date : 08-SEP-2008 Status: PUBLISHED
Applies to:
Enterprise Manager Grid Control - Version:10.1.0.2 to 11.1.0.0
Information in this document applies to any platform.
DBConsole
Purpose
This article provides detailed instructions on how to 1) create, 2) drop and 3)recreate the repository and configuration files for the DB Control application used to manage a single10gDatabase.
Scope and Application
The steps in this article are written for a DBA or System Administrator who needs to create, drop or reconfigure the DB Control Application.
The format of the document will include steps for both 10.1 and 10.2 EMCA because the commands changed between the two releases.
For detailed instructions on DB Control 10.2 for RAC, please consult also:
https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=395162.1&blackframe=1How to manage DB Control 10.2 for RAC Database with emca
How To Drop, Create And Recreate DB Control In A10gDatabase
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:
For DB Control 10.2.x, run the command:
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:
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
Alternatively on Windows XP and Windows Server 2003 you can run the following from the command line:
'sc delete
- where
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 both10gR1 and R2 run:
Warning: this command puts the database in Quiesce Mode.
Please consult thehttps://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=375946.1&blackframe=1Running 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 ManuallyStep 1: Drop AQ related objects in the SYSMAN schema
Logon SQLPLUS as user SYSMAN
SQL> exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'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 INc1 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;
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:
Option 5. Delete DB Control Configuration Files and Repository Objects using EMCA
For DB Control 10.2.x, both configuration files and repository objects can be deleted with a single command. Run the command:
Warning: this command puts the database in Quiesce Mode.
Please consult thehttps://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=375946.1&blackframe=1Running 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:
For DB Control 10.2.x, run the command:
Option 2. Create the DB Control Repository Objects and Configuration Files
For DB Control 10.1.x, run the command:
For DB Control 10.2.x, run the command:
Warning: this command puts the database in Quiesce Mode.
Please consult thehttps://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=375946.1&blackframe=1Running EMCA Results in Database quiesce And No
New Connections or Operations Can Be Performed During the DB Control Repository Creation
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:
Option 2. Recreate the DB Control Configuration Files and Repository
For DB Control 10.2.x, run the command:
Warning: this command puts the database in Quiesce Mode.
Please consult thehttps://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=375946.1&blackframe=1Running 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 Manager10gAdvanced Configuration Guide or seehttps://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=330130.1&blackframe=1Overview Of The EMCA Commands Available for DB Control 10.2References
https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=375946.1&blackframe=1- Problem: Running EMCA Results in Database quiesce And No New Connections or Operations Can Be Performed During the DB Control Repository Creation
https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=395162.1&blackframe=1- How to manage DB Control 10.2 for RAC Database with emca
https://metalink2.oracle.com/metalink/plsql/showdoc?db=NOT&id=456437.1&blackframe=1- Ora-24005 Error Trying To Drop User Sysman Cascade
附:
Note that this command puts the database in Quiesce Mode.Please consult the Note 375946.1
Applies to: Enterprise Manager Grid Control - Version: 10.2.0.1 to 11.1.0.7
This problem can occur on any platform.
SymptomsWhen running 'emca -config dbcontrol db -repos recreate' or 'emca -deconfig dbcontrol db -repos drop' to recreate or drop the Enterprise Manager Database Control configuration files and repository the operation hangs and at the same time users are not able to login to the database. CauseThe emca command, when recreating or dropping the repository, requires the database to be quiesced. This means that, temporarily, no operations are possible on the database and new users cannot login.
If there are active sessions on the database at the time the quiesce operation will hang pending their completion, during which time no new users will be able to connect.
Therefore it is important to understand that running these commands may/will cause the database to be unavailable during the time that the repository is being dropped and should not be run on a production database unless you are fully aware of the possible impact to database availability and have planned for this eventuality
SolutionTo implement the solution, please execute the following steps:
1. Kill the emca command
2. Connect to the database with SYS account through SQL*Plus
SQL > alter system unquiesce;
Run the emca command at a time when there is low system usage.
For additional information on emca, please consult:
Enterprise Manager Advanced Configuration
Topic 1.2.6 Configuring Database Control During and After the Oracle Database 10g Installation
Available on OTN at: