Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

How to create Read-Only database link in oracle

In oracle in few cases as a DBA we have to create the (read-only) only select privilege database link as per the request of developer or tester or QA request. Cause is anything our responsibility is create the select privilege dblink.

Using below steps we can create Read Only DB Link in Oracle Database:

How to create Select privilege DBLINK:

Step 1: Create dummy user in source database.

Sql> create user dummy identified by dummy default tablespace users quota 100m on users;
Sql> grant connect, resource, select any table to dummy;

On Target DB side:
Step1: Copy the tnsnames of source database to target database.
Step2:
Sql> create database link readonly connect to dummy identified by dummy using ‘orcl’;

Now you can test the readonly dblink:

Syntax: Sql> select count(*) from <schema_name>.<table_name>@readonly;


Sql> select * from rak.test@readonly;

How to register the new database to existing Oracle RAC / Grid

How to register new database home, Database and listener into Grid home

As a DBA in some time we have to add node into the Cluster / Grid. We can use the below commands for adding new oracle home, cluster home database and listener.

bash-3.2$ srvctl add database -d prddb -o /oracle/app/product/11.1.0/db_1
bash-3.2$ srvctl add instance -d prddb -i prddb2 -n proddb2
bash-3.2$ srvctl add instance -d prddb -i prddb3 -n proddb3

verify the configuration of database and instances using
bash-3.2$ srvctl config database -d prddb
bash-3.2$ srvctl config database -d prddb -a
proddb1 prddb1 /oracle/app/product/11.1.0/db_1
proddb2 prddb2 /oracle/app/product/11.1.0/db_1
proddb3 prddb3 /oracle/app/product/11.1.0/db_1
DB_UNIQUE_NAME: prddb
DB_NAME: prddb
ORACLE_HOME: /oracle/app/product/11.1.0/db_1
SPFILE: +DG1/nowprod/spfileprddb.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED

We can modify the spfile/pfile parameter location using below command


srvctl modify database -d prddb -p '/oracle/app/product/11.1.0/db_1/spfileprddb.ora' -s open