Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Article 2

$
0
0
TRANSPORTABLE TABLE SPACE STEPS WITH IN SAME PLATFORM:

Step 1:

Stop materialized view refresh jobs

drop materialized view ATS_GEO_COMPONENT_MV preserve table;


Step 2:

Determine the endian format of both the source and destination databases with the following queries.

select * from v$transportable_platform order by platform_id;

SELECT tp.platform_id,substr(d.PLATFORM_NAME,1,30), ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;


Step 3:

Run this script to list all of the tablespaces that are available to be transported

select tablespace_name, block_size from dba_tablespaces where tablespace_name not in ('SYSTEM','SYSAUX') and contents = 'PERMANENT';


Step 4:

Create valid directory for datapump

SELECT * FROM DBA_DIRECTORIES WHERE DIRECTORY_NAME = 'DATA';

OWNER      DIRECTORY_NAME   DIRECTORY_PATH
---------- ---------------- -----------------------------------
SYS        DATA    /ATLDEV12c/bkp

GRANT read, write on directory DATA TO sys;


Step 5:

Generate script to create TTS export, and TTS import Data Pump parameter files, using the below script.

REM
REM Create TTS Data Pump export and import PAR files
REM
set feedback off trimspool on
set serveroutput on size 1000000
REM
REM Data Pump parameter file for TTS export
REM
spool dp_ttsexp.par
declare
tsname varchar(30);
i number := 0;
begin
dbms_output.put_line('directory=DATA_PUMP_DIR');
dbms_output.put_line('dumpfile=dp_tts.dmp');
dbms_output.put_line('logfile=dp_ttsexp.log');
dbms_output.put_line('transport_full_check=no');
dbms_output.put('transport_tablespaces=');
for ts in
(select tablespace_name from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT'
order by tablespace_name)
loop
if (i!=0) then
dbms_output.put_line(tsname||',');
end if;
i := 1;
tsname := ts.tablespace_name;
end loop;
dbms_output.put_line(tsname);
dbms_output.put_line('');
end;
/
spool off
REM
REM Data Pump parameter file for TTS import
REM
spool dp_ttsimp.par
declare
fname varchar(513);
i number := 0;
begin
dbms_output.put_line('directory=DATA_PUMP_DIR');
dbms_output.put_line('dumpfile=dp_tts.dmp');
dbms_output.put_line('logfile=dp_ttsimp.log');
dbms_output.put('transport_datafiles=');
for df in
(select file_name from dba_tablespaces a, dba_data_files b
where a.tablespace_name = b.tablespace_name
and a.tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT'
order by a.tablespace_name)
loop
if (i!=0) then
dbms_output.put_line(''''||fname||''',');
end if;
i := 1;
fname := df.file_name;
end loop;
dbms_output.put_line(''''||fname||'''');
dbms_output.put_line('');
end;
/



Step 6:

check for user-created objects in the system and sysaux tablespaces.

select owner, segment_name, segment_type from dba_segments where tablespace_name in ('SYSTEM', 'SYSAUX') and owner not in (select name
from system.logstdby$skip_support
where action=0);


Step 7:

Create the 'Create user script.

spool def_Tbs.sql
select 'CREATE USER '||username||' IDENTIFIED BY test DEFAULT TABLESPACE SYSTEM;' from dba_users where username not in ('SYS', 'SYSTEM', 'DBSNMP','SYSMAN','OUTLN','MDSYS','ORDSYS','EXFSYS','DMSYS','WMSYS','CTXSYS','ANONYMOUS','XDB','ORDPLUGINS','OLAPSYS','PUBLIC');
spool off


Step 8:

Check containment.

declare
checklist varchar2(4000);
i number := 0;
begin
for ts in
(select tablespace_name
from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX') and contents = 'PERMANENT')
loop
if (i=0) then
checklist := ts.tablespace_name;
else
checklist := checklist||','||ts.tablespace_name;
end if;
i := 1;
end loop;
dbms_tts.transport_set_check(checklist,TRUE,TRUE);
end;
/

select * from transport_set_violations;


Step 9:

Export source metadata.

expdp DIRECTORY=DATA LOGFILE=dp_fullexp_meta.log DUMPFILE=dp_full.dmp FULL=y CONTENT=METADATA_ONLY


Step 10:

Check for tablespaces using a non-default block size


show parameter cache_size;

NAME                 TYPE    VALUE
------------------------------------ ----------- ------------------------------
client_result_cache_size       big integer 0
db_16k_cache_size          big integer 0
db_2k_cache_size           big integer 0
db_32k_cache_size          big integer 1024M
db_4k_cache_size           big integer 0
db_8k_cache_size           big integer 0
db_cache_size            big integer 16G
db_keep_cache_size          big integer 16G
db_recycle_cache_size        big integer 0

select tablespace_name, block_size from dba_tablespaces;

TABLESPACE_NAME                BLOCK_SIZE
------------------------------ ----------
SYSTEM                               8192
SYSAUX                               8192
UNDOTBS1                             8192
TEMP                                 8192
USERS                                8192
USER_DATA                            8192
BIG_DATA                            32768


Step 11:

Create tablespace scripts:

Tablespace read only script.

set heading off
feedback off
trimspool on
linesize 500
spool tts_tsro.sql
prompt /* =================================== */
prompt /* Make all user tablespaces READ ONLY */
prompt /* =================================== */
select 'ALTER TABLESPACE ' || tablespace_name || ' READ ONLY;' from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT';
spool off


Step 12:

Run read only script

@tts_tsro.sql

Step 13:

Tablespace read write script.

set heading off
feedback off
trimspool on
linesize 500
spool tts_tsrw.sql
prompt /* ==================================== */
prompt /* Make all user tablespaces READ WRITE */
prompt /* ==================================== */
select 'ALTER TABLESPACE ' || tablespace_name || ' READ WRITE;' from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT';
spool off


Step 14:

Export the tablespaces.

EXPDP  parfile=dp_ttsexp.par


Step 15:

Copy the following files to a place that is accessible to the destination database.


dp_ttsimp.par   import parameter file

def_Tbs.sql      create user script

dp_full.dmp      metadata dump file

tts_tsrw.sql       script to make tablespaces read write


Step 16:


Create directory in destination database.


SELECT * FROM DBA_DIRECTORIES WHERE DIRECTORY_NAME = 'DATA';

OWNER      DIRECTORY_NAME   DIRECTORY_PATH
---------- ---------------- -----------------------------------
SYS        DATA    /ATLDEV12c/bkp

GRANT read, write on directory DATA TO sys;


Step 17:

Add the db_32k_cache_size parameter to the target database:

ALTER SYSTEM SET db_32k_cache_size='1024M' SCOPE=BOTH;


Step 18:

Create users in the destination database using the following script.

@def_Tbs.sql


Step 19:

Import the tablespaces.

IMPDP parfile=dp_ttsimp.par


Step 20:

Make tablespace read write using the following script.

@tts_tsrw.sql;


Step 21:


Import source metadata to destination database.


impdp DIRECTORY=DATA LOGFILE=dp_fullexp_meta.log DUMPFILE=dp_full.dmp FULL=y CONTENT=METADATA_ONLY


Step 22:

Compile all the invalids.

@utlrp.sql


Step 23:

Check the object count on both matches the source database.















Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>