Skip to content

Commit 7334fc7

Browse files
Merge pull request #3 from oracle-devrel/lift-first-commit
Lift first commit
2 parents 48829ca + 86a3573 commit 7334fc7

File tree

8 files changed

+3381
-0
lines changed

8 files changed

+3381
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Oracle Database Discovery Utility
2+
3+
The Database discovery and analysis tool is a SQL utility that captures necessary details of an oracle database in order to analyse on-premises or cloud Oracle Databases for the suitability of migration/upgrades. This utility runs on Non Container or Container databases and helps in generating HTML report with detailed description.
4+
5+
## When to use this asset?
6+
7+
This script is to be executed in the discovery phase if it is identified the oracle on-premises database is to be migrated to OCI.
8+
9+
## How to use this asset?
10+
```
11+
sqlplus "/ as sysdba" @oradb_discovery_v3_6_11_19.sql
12+
```
13+
14+
### Step 1
15+
This is a discovery utility for Oracle database compatible for 11g onwards with a below features:
16+
1. Current version of the script is v3.6 and it supports Oracle 11g or above database
17+
2. Single version script for both Oracle Multitenant and Non-Multitenant database
18+
3. This is a platform independent script as we need `sqlplus "/ as sysdba" ` to execute only.
19+
20+
This script needs to execute on Oracle database server with a user who has `“/as sysdba” ` access.
21+
• Copy the oradb_discovery_v3_6_11_19.sql file to the server
22+
• To execute the script: `sqlplus "/ as sysdba" @oradb_discovery_v3_6_11_19.sql`
23+
24+
### Step 2
25+
The above script will generate .LST as output files on the same location.
26+
Convert this .LST to .HTML to view the file.
27+
28+
Note: This script generates dynamic files like version_not_matched.sql which gets executed and deleted automatically.
29+
30+
31+
## License
32+
Copyright (c) 2023 Oracle and/or its affiliates.
33+
34+
Licensed under the Universal Permissive License (UPL), Version 1.0.
35+
36+
See [LICENSE](LICENSE) for more details.

cloud-architecture/custom-apps-and-consolidation/oracle-db-consolidation/db-discovery/discovery-utility/files/oradb_discovery_v3_6_11_19.sql

Lines changed: 2716 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2023 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Oradb XTTS Prechecks
2+
3+
XTTS Pre-check for ORACLE Database is a SQL script-based utility that captures the necessary details of an Oracle database in order to analyze the suitability of the XTTS method.
4+
This utility runs on Oracle 11g onwards, both on Container/Non-Container databases, and helps in generating an HTML report with self-contained tablespace violation status and other detailed descriptions.
5+
6+
## When to use this asset?
7+
8+
This script is to be executed in the discovery phase if it is identified the Oracle on-premises database is to be migrated using the XTTS method.
9+
10+
## How to use this asset?
11+
12+
```
13+
sqlplus "/ as sysdba" @oradb_xtts_prechecks.sql
14+
```
15+
16+
This script needs to be executed on an Oracle database server with a user who has ` "/as sysdba" ` access.
17+
18+
- Copy the oradb_xtts_prechecks.sql file to the server.
19+
- Execute the script as ```sqlplus "/ as sysdba" @oradb_xtts_prechecks.sql``` .
20+
21+
The above script will generate a .htm output file on the same location.
22+
23+
## License
24+
Copyright (c) 2023 Oracle and/or its affiliates.
25+
26+
Licensed under the Universal Permissive License (UPL), Version 1.0.
27+
28+
See [LICENSE](LICENSE) for more details.
29+
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
--# Copyright (c) 2023, Oracle and/or its affiliates.
2+
--# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
--# Purpose: This script does self content check on database tablespaces.
4+
--# This script is to be executed at the discovery phase if we identify the oracle database is to be migrated using XTTS method.
5+
--# @author: Ananda Ghosh Dastidar
6+
7+
8+
clear screen;
9+
connect / as sysdba
10+
define disversion = 'v1.4';
11+
12+
col open_mode for a15
13+
col host_name for a45
14+
col name for a15
15+
COL NAME HEADING 'Name'
16+
col pdbconid new_value v_pdbconid;
17+
variable gv_multi NUMBER;
18+
variable gv_dbinfosql REFCURSOR;
19+
set truncate off
20+
set numwidth 15
21+
set heading off
22+
set feedback off
23+
set verify off
24+
set lines 200
25+
set pages 9999
26+
set numf 9999999999999999
27+
set serveroutput on
28+
29+
set heading on timing off
30+
col version heading 'Version'
31+
col startup_time heading 'STARTUP|TIME'
32+
col FORCE_LOGGING format a30 wrap
33+
col OBJECT_NAME for A30
34+
column username for a45
35+
column tablespace_name for a45
36+
37+
PROMPT ****************************************************************************************************************************************
38+
PROMPT | XTTS PRE-CHECK FOR ORACLE DATABASE &disversion |
39+
PROMPT | ( Oracle 11g onwards ) |
40+
PROMPT ****************************************************************************************************************************************
41+
PROMPT
42+
--# Validation Block 2: Checking multitenant database
43+
PROMPT
44+
DECLARE
45+
v_cdb_count number :=0;
46+
BEGIN
47+
EXECUTE IMMEDIATE 'select case when CDB =''YES'' then 1 else 0 END as CDB from sys.v_$database' into v_cdb_count;
48+
49+
If v_cdb_count = 0 THEN
50+
DBMS_OUTPUT.put_line('INFO: This Oracle database is not multitenant!! Please check the details below');
51+
:gv_multi := v_cdb_count;
52+
END IF;
53+
54+
If v_cdb_count = 1 THEN
55+
DBMS_OUTPUT.put_line('INFO: This Oracle database is a multitenant!! Please check the details below');
56+
:gv_multi := v_cdb_count;
57+
END IF;
58+
59+
EXCEPTION WHEN OTHERS THEN
60+
DBMS_OUTPUT.put_line('INFO: This Oracle database is not multitenant!! Please check the details below');
61+
:gv_multi := 0;
62+
END;
63+
/
64+
65+
DECLARE
66+
v_sql varchar2(2000);
67+
BEGIN
68+
IF :gv_multi = 0 THEN
69+
v_sql := 'select d.DBID,d.NAME,i.INSTANCE_NUMBER inst_id,d.OPEN_MODE,i.HOST_NAME,i.INSTANCE_NAME,to_char(i.STARTUP_TIME,''YYYY/MM/DD HH:MI:SS'') open_TIME from sys.v_$database d,sys.v_$INSTANCE i WHERE upper(d.NAME)=substr(upper(i.INSTANCE_NAME),0,length(upper(d.NAME)))';
70+
OPEN :gv_dbinfosql FOR v_sql;
71+
END IF;
72+
IF :gv_multi = 1 THEN
73+
v_sql := 'select p.con_id,p.name, p.inst_id, p.OPEN_MODE,i.host_name,i.instance_name,to_char(p.open_TIME,''YYYY/MM/DD HH:MI:SS'') open_TIME from gv$pdbs p, gv$instance i where i.inst_id=p.inst_id order by 1,2';
74+
OPEN :gv_dbinfosql FOR v_sql;
75+
END IF;
76+
END;
77+
/
78+
print :gv_dbinfosql
79+
BEGIN
80+
IF :gv_multi = 0 THEN DBMS_OUTPUT.put_line('Please verify the instance and press Enter to continue : '); END IF;
81+
IF :gv_multi = 1 THEN DBMS_OUTPUT.put_line('Please verify CDB/PDB instance and Press Enter to continue : '); END IF;
82+
END;
83+
/
84+
ACCEPT v_pdbconid CHAR FORMAT 'A20' PROMPT '>>>>>>' default 2
85+
PROMPT
86+
87+
set markup HTML ON entmap off spool on
88+
alter session set nls_date_format='YYYY-MM-DD HH24:Mi:SS';
89+
alter session set nls_language=american;
90+
91+
REM
92+
REM spool file name AUTOMATICALLY GENERATED
93+
REM
94+
95+
REM Collection name SRDC_ or MOS_
96+
define PREFIXHTM='MF_XTTS_DA'
97+
column ORAGGSPOOLNAME new_val ORAGGSPOOLNAME
98+
column SYSTEMDATE new_val SYSTEMDATE
99+
100+
select sysdate SYSTEMDATE from dual;
101+
select '&&PREFIXHTM'||'_'||upper(instance_name)||'_'||to_char(sysdate,'YYYYMMDD_HH24MISS')||'.htm' ORAGGSPOOLNAME from v$instance, v$database;
102+
103+
spool &ORAGGSPOOLNAME
104+
prompt <p style="text-align: center;"><strong><span style="text-shadow: rgb(136, 136, 136) -2px 0px 7px;"><span style="font-size: 30px; color: rgb(51, 102, 153);">xTTS Pre-check For ORACLE Database &disversion</span></span><span style="text-shadow: 3px 3px 2px rgba(136, 136, 136, 0.8);"> </span></strong>
105+
prompt <span style="font-size: 14px; color: rgb(51, 102, 153); text-shadow: rgb(136, 136, 136) 1px -1px 5px;">( Oracle 11g onwards ) Report Date : &SYSTEMDATE</span></p>
106+
prompt <table border='0' width='90%' align='center'><tr><td colspan=2 style="width:30%"><a name="top"><span style="font-size: 20px; color: rgb(51, 102, 153);"><strong> Main Menu </strong></span></a></td></tr><tr><td> <li style="font-size: 12px; color: rgb(51, 102, 153);"><strong>Configuration Info </strong></li></td><td><a href="#Database">Database Information</a> | <a href="#Additional">Additional Information</a> </td></tr><tr><td> <li style="font-size: 12px; color: rgb(51, 102, 153);"><strong>xTTS Info </strong></li></td><td> <a href="#excludedTBS">Tablespaces excluded for XTTS Migration</a> | <a href="#eligibleTBS">Eligible Tablespace list for XTTS Migration</a> | <a href="#invalidTBS">Invalid userwise DEFAULT tablespace list</a> | <a href="#violation">Self-contained tablespace violations</a></td></tr></table>
107+
108+
PROMPT
109+
prompt <a name="Database"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Database Information : </strong></span></a><a href="#top">Go To Main Menu</a>
110+
SELECT (select DBid from v$database) DB_ID,
111+
(select name from v$database) DB_NAME,
112+
(select instance_number from v$instance) INSTANCE,
113+
(select version from v$instance) DB_VERSION,
114+
(select decode(count(*),3,'1/8th OR Quarter RAC',7,'Half RAC',14,'Full RAC','Non-Exadata') from (select distinct cell_name from gv$cell_state)) Exadata_Option,
115+
(select HOST_NAME from v$instance) HOST_NAME,
116+
(select PLATFORM_ID from v$database) PLATFORM_ID,
117+
(select Platform_name from v$database) OS,
118+
(select VERSION from V$TIMEZONE_FILE) TIMEZ_VER,
119+
(select DECODE(regexp_substr(banner, '[^ ]+', 1, 4),'Edition','Standard',regexp_substr(banner, '[^ ]+', 1, 4)) from v$version where banner like 'Oracle%') DB_EDITION,
120+
(select CREATED from v$database) CREATED,
121+
(Select to_char(startup_time, 'DD-MON-YY HH24:MI') from v_$instance) STARTUP_TIME,
122+
(select round(((select sum(bytes) from dba_data_files))/1024/1024/1024,4) ||' GB' from dual) DB_SIZE from dual;
123+
124+
prompt <a name="Additional"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Database Additional Information : </strong></span></a><a href="#top">Go To Main Menu</a>
125+
SELECT a.DB_UNIQUE_NAME,b.LOGINS,a.LOG_MODE,a.OPEN_MODE,FORCE_LOGGING,a.current_scn CURRENT_SCN,a.DATABASE_ROLE from sys.v_$database a,sys.v_$instance b;
126+
SELECT INSTANCE_NUMBER, INSTANCE_NAME, STATUS FROM GV$INSTANCE;
127+
128+
prompt <a name="excludedTBS"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Tablespaces Excluded For XTTS Migration : </strong></span></a><a href="#top">Go To Main Menu</a>
129+
Prompt Note : Defualt tablespaces are excluded from xTTS migration. Below is the list
130+
select 'SYSTEM,SYSAUX,TEMP,UNDOTBS1,UNDOTBS2' Tablespace_Name from dual;
131+
132+
prompt <a name="eligibleTBS"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Eligible Tablespace List For XTTS Migration : </strong></span></a><a href="#top">Go To Main Menu</a>
133+
Prompt Note : Below is the list of eligible Tablespaces
134+
select LISTAGG(tablespace_name, ',') WITHIN GROUP (ORDER BY tablespace_name) VALID_TABLESPACE_LIST_FOR_XTTS
135+
from (
136+
select d.tablespace_name tablespace_name
137+
from dba_tablespaces d
138+
where (d.CONTENTS not in ('TEMPORARY','UNDO') and d.TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX','TEMP','UNDOTBS1','UNDOTBS2'))
139+
union
140+
select default_tablespace tablespace_name
141+
from dba_users where default_tablespace in (select tablespace_name from dba_tablespaces where TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX','TEMP','UNDOTBS1','UNDOTBS2'))
142+
order by 1
143+
);
144+
145+
prompt <a name="invalidTBS"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Invalid Userwise DEFAULT tablespace List(IF ANY) : </strong></span></a><a href="#top">Go To Main Menu</a>
146+
Prompt Note : Below is the list of invalid userwise DEFUALT tablespace
147+
select username,default_tablespace tablespace_name,'<span style="font-size: 14px; color: rgb(255,0,0);">This Tablespace does not exists/dropped.. Remap this user at Target</span>' TBS_Remarks
148+
from dba_users where default_tablespace not in (select tablespace_name from dba_tablespaces)
149+
order by 1;
150+
151+
prompt <a name="violation"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> Self-contained Tablespace Violations Status(IF ANY) : </strong></span></a><a href="#top">Go To Main Menu</a>
152+
Prompt Note : Status of self-contained tablespace violations
153+
prompt
154+
DECLARE
155+
tbs_list clob;
156+
v_count number :=0;
157+
BEGIN
158+
159+
select LISTAGG(tablespace_name, ',') WITHIN GROUP (ORDER BY tablespace_name) tablespace_name into tbs_list
160+
from (
161+
select d.tablespace_name tablespace_name
162+
from dba_tablespaces d
163+
where (d.CONTENTS not in ('TEMPORARY','UNDO') and d.TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX','TEMP','UNDOTBS1','UNDOTBS2'))
164+
union
165+
select default_tablespace tablespace_name
166+
from dba_users where default_tablespace in (select tablespace_name from dba_tablespaces where TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX','TEMP','UNDOTBS1','UNDOTBS2'))
167+
order by 1
168+
);
169+
170+
sys.DBMS_TTS.TRANSPORT_SET_CHECK(TS_LIST => tbs_list ,INCL_CONSTRAINTS => TRUE,FULL_CHECK => TRUE);
171+
FOR cur_err_desc IN (SELECT VIOLATIONS FROM sys.TRANSPORT_SET_VIOLATIONS)
172+
LOOP
173+
v_count:= v_count + 1;
174+
dbms_output.put_line('<span style="font-size: 14px; color: rgb(255,0,0);">#'||v_count||' Violations found: '||cur_err_desc.VIOLATIONS||'</span>');
175+
END LOOP;
176+
177+
SELECT count(*) into v_count FROM sys.TRANSPORT_SET_VIOLATIONS;
178+
If v_count=0 THEN
179+
dbms_output.put_line('<span style="font-size: 14px; color: rgb(34,139,34);">Success... No violations found based on self-contained tablespace</span>');
180+
END IF;
181+
END;
182+
/
183+
184+
prompt
185+
prompt <a name="eor"><span style="font-size: 16px; color: rgb(51, 102, 153);"><strong> End Of Report: </strong></span></a><a href="#top">Go To Main Menu</a>
186+
set timing off
187+
set markup html off
188+
spool off
189+
prompt
190+
exit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2023 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# ZDM Discovery Utility
3+
4+
ZDM Discovery Utility for ORACLE Database is a SQL script-based utility that captures the necessary details of an Oracle On-Prem database in order to analyze the suitability of logical online migration using ZDM.
5+
This utility runs on Oracle 11g onwards Non-Container database and helps in generating HTML reports with pre-check summaries with required action and other detailed descriptions.
6+
7+
## When to use this asset?
8+
9+
This script is to be executed in the discovery phase if it is identified the Oracle on-premises database is to be migrated using Zero Downtime Migration(ZDM) Tool.
10+
11+
## How to use this asset?
12+
13+
```
14+
sqlplus "/ as sysdba" @oradb_zdmgg_discovery_v1_2.sql
15+
```
16+
17+
This script needs to execute on an Oracle database server with a user who has `"/as sysdba"` access.
18+
- Copy the oradb_zdmgg_discovery_v1_2.sql file to the server.
19+
- Execute the script as ```sqlplus "/ as sysdba" @oradb_zdmgg_discovery_v1_2.sql ``` .
20+
21+
22+
The above script will generate a .htm output file on the same location.
23+
24+
## License
25+
Copyright (c) 2023 Oracle and/or its affiliates.
26+
27+
Licensed under the Universal Permissive License (UPL), Version 1.0.
28+
29+
See [LICENSE](LICENSE) for more details.
30+
31+

0 commit comments

Comments
 (0)