|
-
I pulled this out of one of my hot backup scripts. It will give you some food for thought. Written for a u-nix flavor, modify directories as needed.
rem run as system
set echo off termout off feedback off verify off pages 0 linesize 130
column instnc new_value v_inst noprint
column instdate new_value v_instdate noprint
SELECT TO_CHAR(sysdate,'-dd-Mon-yyyy-hh24-mi-ss') instdate FROM dual;
SELECT name instnc FROM v$database;
alter system checkpoint;
alter system switch logfile;
spool /tmp/DB_BEGIN_HOTBACKUP_&v_inst.sql;
select distinct 'alter tablespace '||tablespace_name||' begin backup;'
from dba_data_files, (select rtrim(lower(name)) dbname from v$database);
spool off;
spool /tmp/DBBACKUP_&v_inst;
select distinct tablespace_name||' '||rtrim(file_name)||' '||
substr(file_name,instr(file_name,'/',-1)+1)
from dba_data_files, (select rtrim(lower(name)) dbname from v$database);
spool off;
spool /tmp/CTLFILES_&v_inst;
select rtrim(name) from v$controlfile;
spool off;
spool /tmp/ARCHLOGS_&v_inst;
select decode(((replace(rtrim(value),', ',''''||'
'||''''))||''''),'''''',NULL,
substr(
substr(value,instr(value,'=')+1),1,instr(substr(value,instr(value,'=')+1),' ')-1)
) from v$parameter where name like 'log_archive_dest_1%'
and name not like 'log_archive_dest_state%'
and value is not null and value not like '%?%';
spool off;
spool /tmp/ALERTLOGS_&v_inst.sql;
select 'host cp ' || rtrim(value) || '/alert*.log /uidprd/oradata/uidprd/backup/.' from v$parameter where name='background_dump_de
spool off;
select rtrim(value) from v$parameter where name='background_dump_dest';
spool off;
spool /tmp/REDOLOGS_&v_inst;
select rtrim(member) from v$logfile;
spool off;
spool /tmp/IFILE_&v_inst;
select rtrim(value) from v$parameter where name='ifile';
spool off;
spool /tmp/restore_datafiles_&v_inst;
select distinct
'uncompress < '||
substr(file_name,instr(file_name,'/',-1)+1) ||'.Z > '||
rtrim(file_name)
from dba_data_files, (select rtrim(lower(name)) dbname from v$database);
spool off;
spool /tmp/restore_controlfiles_&v_inst.sql;
select distinct
'host cp '||
rtrim(name) || ' /uidprd/oradata/uidprd/backup/.' from v$controlfile;
spool off;
spool /tmp/restore_controlfiles_&v_inst;
select distinct
'cp '||' '||
substr(name,instr(name,'/',-1)+1) ||' '||
rtrim(name) from v$controlfile;
spool off;
spool /tmp/restore_redo_&v_inst;
select distinct
'uncompress < '||' '||
substr(member,instr(member,'/',-1)+1) ||'.Z > '||
rtrim(member)
from v$logfile;
spool off;
spool /tmp/restore_ifile_&v_inst.sql;
select distinct
'host cp '||' '||
rtrim(value) || ' /uidprd/oradata/uidprd/backup/. '
from v$parameter where name='ifile';
spool off;
spool /tmp/restore_ifile_&v_inst;
select distinct
'cp '||' '||
substr(value,instr(value,'/',-1)+1) ||' '||
rtrim(value) from v$parameter where name='ifile';
spool off;
spool /tmp/restore_pfile_&v_inst.sql;
select distinct 'host cp ${ORACLE_HOME}/dbs/init'||lower(name)||'.ora /uidprd/oradata/uidprd/backup/.' from v$database;
spool off;
spool /tmp/restore_pfile_&v_inst;
select distinct 'cp init'||lower(name)||'.ora ${ORACLE_HOME}/dbs/.' from v$database;
spool off;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|