OEM Database Preferred Credentials
Author: Chad Cleveland | | July 23, 2019
Fact: Credentials are an essential part of Oracle Enterprise Manager (OEM) security. Named credentials can be used to connect to targets and are saved. Credentials, which are stored in the repository, are also used for default connectivity which allows for easy access and provides another layer of security. A new feature of OEM Cloud Control 12c is the ability to share credentials.
Reality: I like to be able to gather Information from a series of databases in one swoop, rather than connecting to each. Something as simple as checking Database parameters (SQL92_Security, Is Auditing Turned on, Memory Settings…) …or something as easy as creating a New DBA account, resetting passwords in all databases.
Issue: Recently worked a project for more than 30 non-prod to production series of database for a migrations to new hosts. The customer asked for a number of different items such as validate Character Sets, reset service accounts, and get size of database.
OEM Should make this easy for you, but you have to be able to connect to each database. Setting preferred credentials stores database(s) account and passwords in secure fashion. This is helpful in situations mentioned above. Or it can allow you to share a credential with access to RUN Performance to developer in a production database, without allowing him the password or connectivity outside of a controlled application (OEM).
Datavail can locate targets with missing preferred credentials via querying the OEM repository. We can then build dynamic emcli (Enterprise Manager Command Line Interface) commands to build the preferred Credentials in the OEM Application.
I just used queries to locate the missing database targets, generate the EMCLI commands, build the preferred credentials in OEM. Finally, I was able generate the reports and requests from OEM in one swoop rather than having to connect to each host and each database. 🙂
Here’s the snapshot.
SQL> @pc.sql
USER_NAME TARGET_NAME TARGET_TYPE CRED_OWNER CRED_NAME USER_NAME DISPLAY_NAME TARGET_STATUS
---------- ------------ -------------------- --------------- --------------- --------------- ------------------------------ -------------
hdenv1t oracle_database Normal Database Credentials 1
hddev1t oracle_database SYSDBA Database Credentials 1
SQL>
SQL> @create_pc.sql à Generate EMCLI Commands with a standard password for sys and system.
STTM
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
emcli create_named_credential -auth_target_type=oracle_database -cred_scope=Instance -target_type=oracle_database -target_name=hdenv1t -cred_type=DBCreds -cred_name= hdenv1t_normal_pc -attributes="DBUserName:system;DBPassword:SecretPass1234#;DBRole:normal"
emcli create_named_credential -auth_target_type=oracle_database -cred_scope=Instance -target_type=oracle_database -target_name=por99t -cred_type=DBCreds -cred_name= hdenv1t_sysdba_pc -attributes="DBUserName:sys;DBPassword:Kap0w1Sec#;DBRole:sysdba"
No Login to OEM via emcli and build those creds!
oemoms01> emcli login -username=ccleveland
Enter password :
Login successful
oemoms01>
oemoms01> emcli create_named_credential -auth_target_type=oracle_database -cred_scope=Instance -target_type=oracle_database -target_name=hdenv1t -cred_type=DBCreds -cred_name= hdenv1t_normal_pc -attributes="DBUserName:system;DBPassword:SecretPass1234#;DBRole:normal"
Credential hdenv1t_normal_pc created.
oemoms01> emcli create_named_credential -auth_target_type=oracle_database -cred_scope=Instance -target_type=oracle_database -target_name=por99t -cred_type=DBCreds -cred_name= hdenv1t_sysdba_pc -attributes="DBUserName:sys;DBPassword:Kap0w1Sec#;DBRole:sysdba"
Credential hdenv1t_sysdba_pc created.
And swoosh, there you have it. OEM Credentials made simple.
Related Posts
How to Solve the Oracle Error ORA-12154: TNS:could not resolve the connect identifier specified
The “ORA-12154: TNS Oracle error message is very common for database administrators. Learn how to diagnose & resolve this common issue here today.
Oracle Database Extended Support Deadlines: What You Need to Know
If you’re confused about Oracle’s extended support deadlines, you are not alone. Here’s an overview of what’s in store for 11g through 19c.
What Does a DBA Do? 22 DBA Responsibilities You Should Know About: Part I
Not everybody knows what a Database Administrator does. Learn here what DBA job responsibilities are so you can see the depth and breadth of their tasks.