世上没有东西可以取代坚毅的地位,才干不能,有才能而失败者比比皆是;天才不能,才华横溢又毫无进取者不胜枚举;单靠教育不能,受过教育但潦倒终生者充斥世间;惟有坚毅与果断者能够无所不能,得到成功。雷?克罗克
分类: Oracle
2013-04-06 12:53:48
Oracle 的gridcontrol 由两部分组成:dbcontrol 和repository。 我们可以对某一部分进行操作,也可以同时进行操作。
这里先看一个因为修改hostname,导致EM 不能正常使用的例子。
1.1 其中的错误信息如下:
2009-4-10 3:38:49oracle.sysman.emcp.EMReposConfigcreateRepository ?
配置:ORA-01920:用户名'MGMT_VIEW'与另外一个用户名或角色名发生冲突 ?
ORA-06512:在line40 ?
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException:ORA-01920:用户名'MGMT_VIEW'与另外一个用户名或角色名发生冲突 ?
ORA-06512:在line40 ?
2009-4-10 3:03:10oracle.sysman.emcp.EMReposConfigunlockAccounts ?
配置:ORA-06550:第1行,第62列: ?
PLS-00201:必须声明标识符'SYSMAN.MGMT_VIEW_PRIV' ?
ORA-06550:第1行,第62列: ?
PL/SQL: Statement ignored ?
(1)创建一个EM资料库 ?
emca -reposcreate ?
(2)重建一个EM资料库 ?
emca -reposrecreate ?
(3)删除一个EM资料库 ?
emca -reposdrop ?
(4)配置数据库的DatabaseControl ?
emca -configdbcontrol db ?
(5)删除数据库的DatabaseControl配置 ?
emca -deconfigdbcontrol db ?
(6)重新配置db control的端口,默认端口在1158 ?
emca -reconfigports ?
emca -reconfigports -dbcontrol_http_port 1160 ?
emca -reconfigports -agent_port 3940 ?
(7)先设置ORACLE_SID环境变量后,启动EM console服务 ?
emctl startdbconsole ?
(8)先设置ORACLE_SID环境变量后,停止EM console服务 ?
emctl stopdbconsole ?
(9)先设置ORACLE_SID环境变量后,查看EM console服务的状态 ?
emctl statusdbconsole ?
(10)配置dbconsole的步骤 ?
emca -reposcreate ?
emca -configdbcontrol db ?
emctl startdbconsole ?
(11)重新配置dbconsole的步骤 ?
emca -reposdrop ?
emca -reposcreate ?
emca -configdbcontrol db ?
emctl startdbconsole ?
这里的重建包括2部分: dbcontrol 和repository。具体参考2.5小结。
我们的db是11.2.0.3的。
(1)删除dbcontrol 和repository:
(2)重新创建dbcontrol 和repository:
EMCA FailsWithError "ORA-00955: name is already used by an existing object"ForSYNONYM MGMT_AVAILABILITY [ID 470246.1]
2.1.1 Applies to:
Enterprise Manager Grid Control - Version:11.1.0.6 andlater [Release: 11.1 and later ]
Information in this document applies to any platform.
2.1.2 Symptoms
While recreating the database control in11g database, it fails asbelow errors in emca_repos_create_timestamp.logfile
Dec 9, 2007 10:41:26 AMoracle.sysman.emcp.EMReposConfigcreateRepository
CONFIG: ORA-00955: name is already used by an existingobject
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-00955:nameis already used by an existing object
atoracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1500)
atoracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:874)
atoracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:270)
atoracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:311)
at oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:492)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:218)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:147)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:221)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:534)
atoracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1214)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:518)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:467)
Dec 9, 2007 10:41:26 AM oracle.sysman.emcp.EMReposConfig invoke
SEVERE: Error creating the repository
CREATE PUBLIC SYNONYM MGMT_AVAILABILITY FORMGMT_AVAILABILITY
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
2.1.3 Cause
Related EMCA THROWS CONFIG: ORA-00955 CREATE PUBLIC SYNONYMMGMT_AVAILABILITY FORMGMT_A
2.1.4 Solution
As a workaround,
Drop the Repository using RepManager:
Note
: This will not remove theconfiguration files, but only therepository
related objects from the database.Also, the database will be put
inQuiescing mode when RepManager is ran.
Refer RunningEMCA
Results in Database quiesce And No New Connectionsor Operations Can
BePerformed During the DB Control Repository Creation
If above
RepManager fails with conflicts for any other SYNONYM thenmanuallydrop
the DBConsole repository and objects referring to HowTo Drop, Create And Recreate DB Control In A 10g Database
2.1.5 示例:
[oracle@dave bin]$ ./RepManager dave 1521anqing -action drop
Enter SYS user's password :
Enter repository user name : sysman
Getting temporary tablespace fromdatabase...
Found temporary tablespace: TEMP
Checking SYS Credentials ... rem errorswitch
OK.
rem error switch
Dropping the repository..
Checking for Repos User ... Exists.
Repos User exists..
Clearing EM Contexts ... OK.
Dropping EM users ...
Done.
Dropping Repos User ...
Done.
Dropping Roles/Synonymns/Tablespaces ...Done.
Dropped Repository Successfully.
EMCA FailsWith Error "ORA-12514"and "SEVERE: Listener is not up. Start theListener and run EMConfiguration Assistant again." [ID 368591.1]
2.2.1Appliesto:
Enterprise Manager for RDBMS - Version:10.2.0.1 andlater [Release: 10.2 and later ]
Information in this document applies to any platform.
2.2.2Symptoms
EMCA command to configure DBConsole failswith below error inemca_timestamp.log file
Aug 22, 2008 6:41:23 AMoracle.sysman.emcp.util.GeneralUtilinitSQLEngine
CONFIG: SQLEngine created successfully and connected
Aug 22, 2008 6:41:23 AMoracle.sysman.emcp.ParamsManagercheckListenerStatusForDBControl
CONFIG: ORA-12514: TNS:listener does not currently knowof service requested inconnect descriptor
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException:ORA-12514:TNS:listener
does notcurrently know of service requested in connectdescriptor
atoracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1530)
at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeSql(SQLEngine.java:1771)
atoracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:2707)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:368)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:147)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:221)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:534)
atoracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1214)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:518)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:467)
Aug 22, 2008 6:41:23 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Listener is not up. Start the Listener and run EMConfigurationAssistant again .
Refer to the log fileat/apps/ora11g/cfgtoollogs/emca/ORADB11G/emca_2008_08_22_06_40_44.log for
more details.
Aug 22, 2008 6:41:23 AM oracle.sysman.emcp.EMConfig perform
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Listener is not up. StarttheListener and run EM Configuration Assistant again .
at oracle.sysman.emcp.ParamsManager.checkListenerStatusFor
OR running EMCA to drop a repository in a cloneddatabase, fails with the error:
Could not connect to
SYS/(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTO =TCP)(HOST
=hrmsdev1)(PORT=9404)))(CONNECT_DATA=(SERVICE_NAME=hostname..domain))):
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor (DBD ERROR: OCIServerAttach)
2.2.3 Cause:
The
error indicates that the SERVICE_NAMEtried to access by clientis not
found with the targeted listener.There areseveral cause for the
errormessage ORA-12514, like Listener is running on annon default port.
SID is not registered to the listener
The SERVICE_NAME listed in the connect descriptor is incorrect
2.2.4 Solution
1. Check whether the hostname and portspecified in the connectdescriptor are correct for the database service.
2.
Check listener.ora file so that it will match the settings in
thedatabaseparameters like db_domain, service_names, db_unique_name.
3. Try to connect to the database from sqlplus using the listener
Example
sqlplus sys/
If above command fails with ORA-12514 then refer TroubleShootingGuide For ORA-12514 TNS:listener could notresolve SERVICE_NAME given in connectdescriptor
4.
Check the service SERVICE_NAME listed in the connect descriptor and
makesureits correct as per the listener status output. In this case it
hastwoconnecting dots between the hostname and the domainname
5. If the listener is not running on the default port 1521 thensetlocal_listener parameter on database side.
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
SQL> alter system set local_listener='
System altered.
OR
SQL> alter systemsetlocal_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=hostname.com)(PORT=1522))';
System altered.
+
Make sure the connection to the database is working from sqlplus
usingthelistener.Once the connection is working fine re run the failed
EMCA command.
EMCA FailsWith Error "SEVERE: Errorcreating the repository" and"ORA-20001: SYSMAN already exists"While Creating DBConsole [ID549896.1]
2.3.1 Applies to:
Enterprise Manager Grid Control - Version:10.2.0.1 to 11.2.0.1 -Release: 10.2 to 11.2
Information in this document applies to any platform.
2.3.2 Symptoms
While executing the Enterprise ManagerConfiguration Assistant(EMCA) command (emca -config dbcontrol db -reposcreate) to create the DBConsolerepository, the following error is reported tothe screen:-
Do you wish to continue? [yes(Y)/no(N)]:yes
INFO: This operation is being loggedat
INFO: Creating the EM repository (this may take a while) ...
SEVERE: Error creating the repository
INFO:
Refer to the log file
at
SEVERE: Error creating the repository
Refer to the log fileat
Could not complete the configuration. Refer to the log fileat
emca_
in$ORACLE_HOME/cfgtoollogs/emca/
INFO: Creating the EM repository (this maytake a while) ...
May 25, 2010 2:21:30 PM oracle.sysman.emcp.EMReposConfig createRepository
CONFIG: ORA-20001: SYSMAN already exists..
ORA-06512: at line 17
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException:ORA-20001:SYSMAN already exists..
ORA-06512: at line 17
SEVERE: Error creating the repository
May 25, 2010 2:21:30 PM oracle.sysman.emcp.EMReposConfig invoke
INFO:
Refer to the log file
at
emca_repos_create_
DECLARE
*
ERROR at line 1:
ORA-20001: SYSMAN already exists..
ORA-06512: at line 17
2.3.3 Cause
This is causedby the fact that the DBConsole repository alreadyexists for thisdatabase. This can also sometimes be seen if the dbconsolehas beenpreviously dropped (including the repository), but for some reason theSYSMANaccount may not have been completely removed as part of the drop process.
2.3.4 Solution
1. Since the repository alreadyexists, it is only necessaryto create the configuration files using:
emca -configdbcontrol db
and provide answers to the prompts.
2.
Alternatively, if it is deemed preferrable to create afreshdbconsole,
the existing dbconsole repository (including sysmanschema)needs to be
dropped first.
To drop the existingrepository please follow below steps.
(1) Drop theexisting repository
emca -deconfigdbcontrol db -repos drop
For more details Refer How
To Drop, Create And Recreate DB Control In A 10g Database. Repository
canbe dropped either using above emca command or manually asexplained in
<>
Note : Above emca -drop command requiresthe
database to bequiesced. This means that, temporarily, no operations
arepossible on thedatabase and new users cannot login.
Refer RunningEMCA
Results in Database quiesce And No NewConnections or Operations Can
BePerformed During the DB Control RepositoryCreation
(2) Once theDBconsole repository isdropped run the emca command to create thedbconsole :
emca -configdbcontrol db -repos create
How tochange the Hostname when Oracle 10Gand ASM are used [ID 422729.1]
2.4.1 Applies to:
Oracle Server - Enterprise Edition -Version: 10.1.0.2 to 10.2.0.4
Information in this document applies to any platform.
2.4.2 Goal
For Windows, what areas of the 10G Oracledatabase, ASM and EM, oneneeds to consider when changing the server'sHostname?
2.4.3 Solution
When changing the Hostname, 4 files orareas would beaffected:
1) tnsnames.ora
2) listener.ora
3) Oraclecsservice
4) Enterprise Manager
** Note: After Changing the Hostname and Before StartingtheServices, please check the below **
1 & 2) The tnsnames.ora andlistener.orafiles
**
If the IP address is referred in these files then there will
not beanyproblem, else you need to change the Hostname in the tnsnames
of theclientsconnecting to the server and the listener on the Server **
tnsnames :
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
listener:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
Listener
)
)
3) Oraclecsservice
The Hostname will be hard-coded in the CSService, so we need to RecreatetheService
Steps to Recreate the CSService
Login as a user that is a member of theAdministrator's group
Go to %ORACLE_HOME%/bin directory,where ASM runs of
Example:
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
4) EM
If the Hostname is changed, then the EMDbcontrolrepository has to be recreated.
To recreate the EM DBcontrol repository,please see the followingarticle:
HowToDrop, Create And Recreate DB Control In A 10g Database
How To Drop,Create And Recreate theDatabase Control (DB Control) Release 10g and 11g [ID278100.1]
2.5.1 Applies to:
Enterprise Manager Grid Control - Version:10.1.0.2 to 11.2.0.2 -Release: 10.1 to 11.2
Enterprise Manager for RDBMS -Version:10.1.0.5 to 11.2.0.2 [Release: 10.1 to 11.2]
Information in this document applies to any platform.
DBConsole
2.5.2 Purpose
This article provides detailed instructionson how to 1) create, 2)drop and 3)recreate the repository and configurationfiles for the DB Controlapplication used to manage a single 10g Database.
ATTENTION!
After 31-Dec-2010, creating/recreating/securing10.2.0.4/10.2.0.5EM DB Control will fail due to the expiration of the CertificateAuthority. Moreinformations in:
ATTENTION:Patch Required If You Plan To ConfigureEnterprise Manager Database Control WithOracle Database 10.2.0.4 Or 10.2.0.5On Or After 31-Dec-2010
RecoveringFrom Database Control Configuration Errors Due toCA Expiry on Oracle Database10.2.0.4 or 10.2.0.5
--传说中让N多OCM 挂掉的bug
2.5.3 Scopeand Application
The steps inthis article are written for a DBA or SystemAdministrator who needs to create,drop or reconfigure the DB ControlApplication.
The format ofthe document will include steps for both 10.1, 10.2and 11.x EMCA because thecommands changed between these releases.
For detailedinstructions on DB Control on RAC, please consultalso:
Document395162.1 -How to manage DB Control 10.2 for RAC Database with emca
Document578011.1 -How to manage DB Control 11.x for RAC Database with emca
步骤如下:
Option 1. Delete DB ControlConfiguration Files using EMCAscripts
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 RepositoryObjectsusing EMCA
(1)Option 1. Delete DB Control ConfigurationFilesusing EMCA scripts:
DB Control 10.1.x
DC Control 10.2.x and 11.x
Important Note: the option -deconfig removes the EM jobsfrom Scheduling before theDB Control is deconfigured. Otherwise the repository,which is not dropped,could be corrupted or inconsistent if EM jobs werescheduled as the time the DBControl is dropped. It could also cause some errorsduring the DB Controldeletion.
(2)Option 2. Delete DB Control ConfigurationFilesManually:
Remove the following directories from yourfilesystem:
If
the dbcontrol is upgraded from lower version, for
example,from 10.2.0.3to 10.2.0.4, then the following directory also
needs to beremoved from the 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 thefollowingfrom the command line:
'sc delete
- where
OR use the command,
'nmesrvops delete
- where
Also available from Microsoft is the delsrv.exe command. (Freedownloadfrom Microsoft)
(3)Option 3. Delete DB Control RepositoryusingRepManager:
This
option is not as complete as the otheroptions. You may find
thatdropping the repository using the commandlineoptions is a
bettersolution. Also note, RepManager is not used to createa DB
ControlRepository.
All DB Control Releases:
(4)Option 4. Delete DB Control RepositoryObjectsManually
Step 1: Drop AQ related objects inthe SYSMAN schema
DB Control 10.x to 11.1.x
Logon SQLPLUS as user SYS
SQL>execDBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);
DB Control 11.2.x
Logon SQLPLUS as user SYS
SQL>execDBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);
Step 2: Drop the DB ControlRepository Objects
Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account andmanagementobjects:
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
fromthedatabase; under certain circumstances (e.g. you want to recreate
therepositorylater on) the following statements will be sufficient to
remove therepository:
Logon SQLPLUS as user SYS or SYSTEM, and drop thesysman account and management objects:
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;
(5)Option 5. Delete DB Control ConfigurationFilesand Repository Objects using EMCA
For
DB Control 10.1.x, droppingboth the configurationfiles and the
repository objects is a two stepprocess. Run thefollowing two commands:
For
DB Control 10.2.x and11.x, both configurationfiles and
repositoryobjects can be deleted with a single command. Run the command:
Warning: this command puts the database inQuiesce Mode for the DBControl Releases 10.x to 11.1.x.
Beginning DB Control Release 11.2, the database is not put in quiescemodeanymore.
Please consult the RunningEMCA
Results in Database quiesce And No NewConnections or Operations Can
BePerformed During the DB Control RepositoryCreation
Option 1. Create the DB ControlConfiguration Files
Option 2. Create the DB Control Repository Objects and ConfigurationFiles
(1)Option 1. Create the DBControlConfiguration Files
To
create only the DB Control configuration files, skipping
therepositorycreation (this would be done for instance if you dropped
only thefiles andleft the repository in place):
For DB Control 10.1.x
For DB Control 10.2.x and 11.x:
(2)Option 2. Create the DB Control RepositoryObjectsand Configuration Files
For DB Control 10.1.x:
For DB Control 10.2.x and 11.x:
IMPORTANT: Before creating the DB ConsoleRepository objects, makesure that the repository was dropped using the stepsin chapter 1 above..
Option 1. Recreate the DB ControlConfiguration Files only (leaveRepository intact)
Option 2. Recreate the DB ControlConfiguration Files andRepository
In 10.2 and 11.x, the EMCA commands can be used to reconfigure theexistinginstalls without removing them first.
Option 1. Recreate the DB ControlConfiguration Filesonly (leave Repository intact):
For DB Control 10.2.x and 11.x, run the command:
Option 2. Recreate the DB ControlConfiguration Filesand Repository
For DB Control 10.2.x and 11.x, run the command:
Warning: this command puts the database in QuiesceMode for the DBControl Releases 10.x to 11.1.x.
Beginning DB Control Release 11.2, the database is not put in quiescemodeanymore.
Please consult the RunningEMCA
Results in Database quiesce And No NewConnections or Operations Can
BePerformed During the DB Control RepositoryCreation
Oracle Database 11gRelease 2
Available at:
Oracle Database Administrator's Guide
11g Release 2 (11.2) - Part Number E17120-06
Topic: Configuring Database Control During and After Installation
Oracle Database 11g Release 1
Available at
Oracle Database Utilities
11g Release 1 (11.1) - Part Number B28319-02
Topic: Enterprise Manager Configuration Assistant (EMCA)
Oracle Database 10g Release 2
Available at
Oracle Enterprise Manager Grid Control Installation and Configuration Guide
10g Release 5 (10.2.0.5.0) - Part Number E10953-14
Topic: Understanding the Enterprise Manager Directories Installed with OracleDatabase10g
Topic: Configuring Database Console During and After the Oracle Database10gInstallation