Monday, December 30, 2013

How to create dblink using encrypted password (identified by values)

1. Often there are situations where one needs create database link but doesn't know destination schema password, only name of schema is known. The password (identified by values 'long_string_of_values') can be selected from the output (on destination database) using command

SQL> select dbms_metadata.get_ddl ('USER',username) from dual ;

'identified by values' part of the output can be used in create database link statement, an also for create another user with the same password.

This works only with versions of Oracle Database till 11.2.0.4 in cases of creating/duplicating database links, but this 'technique' can be used to prolong expired schema passwords on databases 11.2.0.4 and newer.

2. Another 'solution' working only with versions of Oracle Database till 11.2.0.4, can be used to obtain password string from existing database link.

There is a view called KU$_DBLINK_VIEW. In column PASSWORDX it contains encrypted dblink-like password (not like in USER$). That string can be used as password in clause identified by values of CREATE DATABASE LINK command:

SQL> create database link link_name connect to username identified by values 'PASSWORDX' using 'connect_string' ;

3. From 11.2.0.4 and further, there are two possible options :
- using plane passwords in db_link statement ("identified by ", not by "identified by values ...") ;
- using expdp/impdp solution for duplicating database link. The passwords are kept as its were, but renaming of database link is not supported (there are no remap_dblink parameter for impdp). It is possible to solve it by unsupported way - modify name in link$ system table with flushing of shared pool aftermath.

PS. In Oracle9i the passwords of database links' destination schemas were kept in plane text in link$ dictionary table and in ku$_dblink_view also.

Good Luck !!!

Sunday, December 8, 2013

How to change Oracle resource autostart option (AUTO_START)


In CRS (GI) versions before 12c, to view resource's autostart option, run

> crs_stat -p resource_name

and find the line :
AUTO_START=0 - start resource after starting crsd if it was up before 
AUTO_START=1 - start resource after starting crsd AUTO_START=2 - do not start resource after starting crsd

To change that use next actions.
1. Create resource profile from CRS registry as file as

> crs_stat -p resource_name > /CRS_HOME/crs/public/resource_name.cap

2. Edit the profile using text editor.

3. Unregister resource

> crs_unregister resource_name

4. Register resource

> crs_register resource_name

5. Check the resourse's profile

> crs_stat -p resource_name

P.S. In recent versions of Grid Infrastructure (from 12c) you could use :

> crsctl modify resource resource_name -attr AUTO_START={always|restore|never} -unsupported 

or

> srvctl modify resource_type -policy {automatic|manual|norestart|useronly}

These values are quite different in their meaning (you can always consult the documentation about it), but crsctl AUTO_START=restore is equivalent to srvctl policy automatic.

Good Luck !