Oracle

ODA Database 삭제(WEB-console(Mgmt)안될때 - Derby db사용)

민이단 2023. 7. 7. 14:03

예전에 ODA 구축 이 후 database 를 잘못만들어서 삭제를 해야했는데 웹콘솔에서 삭제가 제대로 안돼서 

SR진행하여 아래 내용을 제공받아 사용했다. 삭제는 성공적으로 잘 되었던 것으로 기억한다. 

아마 Web에서 삭제를하면 ASM쪽이였나.. 어디에 무언가가 제대로 삭제가 안됐던것으로 기억한다.

 

ODA X8-2 HA BM이였던 것으로 기억한다.

============================================================================================

Derby DB를 사용하여 DB 삭제

============================================================================================

1. Download the Derby
 
OR
 
 
OR
 
 
2. Copy the following jars in db-derby-10.14.2.0-bin.zip to /tmp/ on all ODA Servers.
 
derby.jar
derbyclient.jar
derbytools.jar
 
 
3) Take a backup of the derby files before performing the action plan( It's Mandatory)
 
Node#0
-----------
cp -r /opt/oracle/dcs/repo/node_0 /tmp or any location / ---------> (take derby backup on both nodes)
cp -r /opt/oracle/dcs/repo/node_1 /tmp or any location / ---------> (take derby backup on both nodes)
 
Node#1
-------------
cp -r /opt/oracle/dcs/repo/node_0 /tmp or any location / ---------> (take derby backup on both nodes)
cp -r /opt/oracle/dcs/repo/node_1 /tmp or any location / ---------> (take derby backup on both nodes)
 
 
we have to do the below steps on both nodes.
-------------------------------------------------------------------
 
4) Stop dcsagent on both nodes using:
 
# systemctl stop initdcsagent
 
5) Change directory to the repo where derby database located for this node (On both nodes)
 
Example:
----------
 
[root@m003 tmp]# cd /opt/oracle/dcs/repo/
 
[root@m003 repo]# ls
 
node_0 ==>On first Node
node_1 ==>On Second Node
 
6) connect derby client as follows:
 
example
------------
 
java -cp /tmp/derby.jar:/tmp/derbytools.jar org.apache.derby.tools.ij
ij version 10.11
 
7) connect to the database then use SQL commands to see or update the database.
 
ij>connect 'jdbc:derby:node_0'; ----> if node 0
 
 
[Kindly check if databaseUniqueName='TEST1' is present in any of tables
[DB, DbStorageDetails, dbStorageLocations].
If yes delete them on BOTH nodes]
 
8) ij>show tables;
 
9) ij> select id,name,dbname,dbid,status,DBSTORAGE from db where dbname='&DELETEDDATABASENAME';
 
>> It should return 1 row for the deleted database
 
10) ij>select id,name,status,dbstorage from DBSTORAGELOCATIONS where name='&DELETEDDATABASENAME';
 
>> It should return 1 row for the deleted database
 
11) ij>select id,name,status,databaseuniquename from DbStorageDetails where
databaseuniquename='&DELETEDDATABASENAME';
 
>> It should return 1 row for the deleted database
 
12) ij> select ID from DBSTORAGEDETAILS where DATABASEUNIQUENAME='&DELETEDDATABASENAME';
 
>> It should return 1 row for the deleted database
 
13) ij> select DBSTORAGEDETAILS_ID ,VOLNAME from DBSTORAGEDETAILS_VOLS where
DBSTORAGEDETAILS_ID=(select ID from DBSTORAGEDETAILS where
DATABASEUNIQUENAME='&DELETEDDATABASENAME');
 
>> It should return rows for the deleted database
 
14) Since DBSTORAGEDETAILS_VOLS and DBSTORAGEDETAILS has the parent-child relationship, hence first need
to remove the rows from the parent tabl
 
ij> delete from DBSTORAGEDETAILS_VOLS where DBSTORAGEDETAILS_ID=(select ID from DBSTORAGEDETAILS
where DATABASEUNIQUENAME='&DELETEDDATABASENAME');
 
15) Now delete rows from the other tables
 
ij> delete from DBSTORAGEDETAILS where DATABASEUNIQUENAME='&DELETEDDATABASENAME';
 
16) ij> delete from DBSTORAGELOCATIONS where name='&DELETEDDATABASENAME';
 
17) ij> delete from db where dbname='&DELETEDDATABASENAME';
 
18) ij> commit;
 
19). Now odacli list-databases should not show the orphan entries of the deleted database.
 
20) Exit from Derby and start DCS Agent on both nodes.
 
. Start dcsagent:
systemctl start initdcsagent