Вы находитесь на странице: 1из 4

1.

s
2.
3.
4.
5.
6.
7.
8.
9.

Bring down the database and bring it to restrict mode to clean all connection
Check invalid object information by owner and by object"
Ensure all database components are valid"
Ensure that there are no duplicate objects in the SYS and SYSTEM schema"
Ensure no files are in recovery mode"
Take the location of all files"
Analyze databasse dictionary statistics and fixed object stats"
Check for corruption in the dictionary"
Rename init and spfile of current Home and move init file to 11204 home"

sqlplus -s /nolog
conn /as sysdba
create pfile from spfile;
purge dba_recyclebin;
shutdown immediate
startup restrict
@$ORACLE_HOME/rdbms/admin/utlrp.sql ==> To validate invalid objects
spool invalid_object.log
set head on
set lines 120
set pages 10000
col object_name format a40
col object_type format a15
select object_name, object_type, owner, status from dba_objects where status=
'INVALID' order by owner;
set head off
set head on
select owner, count(1) from dba_objects where status='INVALID' group by owner
;
spool off
spool db_components_status.log
set head on
set lines 100
col comp_name format a45
select comp_name, version, status from dba_registry;
set head off
spool off
spool dup_sys_system.sql
set head on
column object_name format a30
select object_name, object_type

from dba_objects
where object_name||object_type in
(select object_name||object_type
from dba_objects
where owner = 'SYS')
and owner = 'SYSTEM';
set head off
spool off
spool db_links.sql
set head on
SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(1)
||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(1)
||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING
'''||L.HOST||''''
||chr(10)||';' TEXT
FROM SYS.LINK$ L, SYS.USER$ U
WHERE L.OWNER# = U.USER#;
spool off
spool backup_invalid.log
set head off
set head on
SELECT * FROM v$recover_file;
SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';
SELECT STATUS,COUNT(1) FROM V$DATAFILE GROUP BY STATUS;
SELECT STATUS,COUNT(1) FROM V$TEMPFILE GROUP BY STATUS;
set head off
spool off
set head on
SELECT username, default_tablespace FROM dba_users WHERE username in ('SYS','
SYSTEM');
set head off
set head on
SELECT owner,tablespace_name FROM dba_tables WHERE table_name='AUD$';
set head off
spool analyze.sql
set head on
Set verify off
Set space 0
Set line 120
Set heading off
Set feedback off
Set pages 1000
SELECT 'Analyze cluster "'||cluster_name||'" validate structure cascade;'
FROM dba_clusters
WHERE owner='SYS'
UNION
SELECT 'Analyze table "'||table_name||'" validate structure cascade;'
FROM dba_tables
WHERE owner='SYS'

AND partitioned='NO'
AND (iot_type='IOT' OR iot_type is NULL)
UNION
SELECT 'Analyze table "'||table_name||'" validate structure cascade into invalid
_rows;'
FROM dba_tables
WHERE owner='SYS'
AND partitioned='YES';
spool off
@$ORACLE_HOME/rdbms/admin/utlvalid.sql

Вам также может понравиться