Sunday, 6 April 2014

How To Uninstall Or Reinstall Database Vault in 11gR2

1) Stop Database Control, the listener and the database

2) Disable Database Vault :
chopt disable dv

3) Start the listener and the database.

4) Identify the DV_OWNER and DV_ACCTMGR users that were configured:
select unique GRANTEE from dba_role_privs
where GRANTED_ROLE in ('DV_ACCTMGR','DV_OWNER')
and grantee <> 'DVSYS';

5) Run script dvremov.sql as SYSDBA after setting parameter recyclebin to OFF:
conn / as sysdba
alter system set recyclebin=off scope=spfile;

shutdown immediate
startup
run ?/rdbms/admin/dvremov.sql

After this only DVSYS and DVF users and DV roles are removed, but the security admin and account manager accounts are not removed as they are considered custom database accounts. They have to be removed manually, use the usernames obtained in step 5. (take care not to drop any users that you may have granted these roles manually):

conn / as sysdba
drop user &DV_OWNER cascade;
drop user &DV_ACCTMGR cascade;

dvremov.sql just removes the DV components and does not affect in any way OLS.

6) Turn on recycle bin if it was turned off before


At this stage Database Vault is removed from the database and the binaries are relinked with dv_off. If Database Vault is not needed (all you wanted to do was to remove/uninstall it) then stop here and restart the database. If Database Vault needs to be enabled then do the following:

1) Stop Database Control, listener and database.

2) Enable DV :
chopt enable dv

3) Start the listener and the database

4) Run DBCA again to register Database Vault. If it is not possible to run the DBCA GUI then run dbca silently:
dbca -silent -configureDatabase
-sourceDB <source database sid>
[-sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>]
-addDBOption DV,OMS
-dvUserName <DV owner>
-dvUserPassword <DV owner passwd>
-dvAccountManagerName <DV acctmgr>
-dvAccountManagerPassword <DV acctmgr passwd>

Saturday, 5 April 2014

How To Uninstall Or Reinstall Database Vault in 11gR1 and 11.2.0.1

Sometimes you require to uninstall or reinstall the database vault.These Steps are valid for 11gR1 and 11.2.0.1 database.For 11gR2(11.2.0.2 & others) please check my another Blog How To Uninstall Or Reinstall Database Vault in 11gR2

1) Stop Database Control, the listener and the database

2) Disable Database Vault :
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk dv_off ioracle

3) Start the listener and the database.

4) Disable the Database Vault triggers :
conn / as sysdba
alter trigger dvsys.dv_before_ddl_trg disable;
alter trigger dvsys.dv_after_ddl_trg disable;

5) Identify the DV_OWNER and DV_ACCTMGR users that were configured:
select unique GRANTEE from dba_role_privs
where GRANTED_ROLE in ('DV_ACCTMGR','DV_OWNER')
and grantee <> 'DVSYS';

6) Run script dvremov.sql as SYSDBA after setting parameter recyclebin to OFF:
Note: In 11.2.0.1 run the following statements before running dvremov.sql:

update dvsys.config$ set status=0;
commit;

conn / as sysdba
alter system set recyclebin=off scope=spfile;

shutdown immediate
startup

run ?/rdbms/admin/dvremov.sql

After this only DVSYS and DVF users and DV roles are removed, but the security admin and account manager accounts are not removed as they are considered custom database accounts. They have to be removed manually, use the usernames obtained in step 5. (take care not to drop any users that you may have granted these roles manually):

conn / as sysdba
drop user &DV_OWNER cascade;
drop user &DV_ACCTMGR cascade;

dvremov.sql just removes the DV components and does not affect in any way OLS.

7) Run dbms_network_acl_admin.drop_acl (In 11gR2 this is included in dvremov.sql) :
conn / as sysdba
exec DBMS_NETWORK_ACL_ADMIN.DROP_ACL ('/sys/acls/dvsys-network-privileges.xml');
commit;

8) Turn on recycle bin if it was turned off before


At this stage Database Vault is removed from the database and the binaries are relinked with dv_off. If Database Vault is not needed (all you wanted to do was to remove/uninstall it) then stop here and restart the database. If Database Vault needs to be enabled then do the following:

1) Stop Database Control, listener and database.

2) Enable DV :
sqlplus / as sysdba
shutdown immediate

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk dv_on ioracle

3) Start the listener and the database

4) Run DBCA again to register Database Vault. If it is not possible to run the DBCA GUI then run dbca silently:

dbca -silent -configureDatabase
-sourceDB <source database sid>
[-sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>]
-addDBOption DV,OMS
-dvUserName <DV owner>
-dvUserPassword <DV owner passwd>
-dvAccountManagerName <DV acctmgr>
-dvAccountManagerPassword <DV acctmgr passwd>

Friday, 4 April 2014

Script to check the Database Vault Realms, Command Rules and Rule Sets

1) Listing the Database Vault realms: 

set linesize 2000
set lines 1000 pages 499
column realm_name format a40
column col1 format a30
column col2 format a30 Heading "Owner / Grantee "
column col3 format a30 Heading "Object Type/Rule Set Name"
column col4 format a30 Heading "Object Name/Auth Options"
break on realm_name skip 3

select * from (
SELECT realm_Name , 'protected objects' col5, owner col2 , object_type col3 ,object_name col4
FROM dvsys.dba_dv_realm_object
union
select REALM_NAME ,'authorizations' col5, GRANTEE col2 ,AUTH_RULE_SET_NAME col3 , AUTH_OPTIONS col4
from dvsys.dba_dv_realm_auth )
order by realm_name asc ,col5 desc
/


2) Listing the Database Vault command rules: 

set linesize 2000
set lines 1000 pages 499
column COMMAND format a30
column RULE_SET_NAME format a30
column OBJECT_OWNER format a30
column OBJECT_NAME format a30
column ENABLED format a30
column PRIVILEGE_SCOPE format a30
select * from dvsys.DBA_DV_COMMAND_RULE;


3) Listing the Database Vault rules and rule sets:

column RULE_SET_NAME format a30
column RULE_NAME format a50
column RULE_EXPR format a60
column ENABLED format a8
column RULE_ORDER format 9999
break on RULE_SET_NAME skip 3

select * from dvsys.DBA_DV_RULE_SET_RULE;

Script To List The Database Vault Realms, Command Rules And Rule Sets (Doc ID 1352556.1)