ITPub博客

首页 > Linux操作系统 > Linux操作系统 > windows_db_script

windows_db_script

原创 Linux操作系统 作者:golden_zhou 时间:2011-08-03 09:36:10 0 删除 编辑

primary db:

autocheck.bat

set ORACLE_SID=dt2esd

sqlplus "sys/'sys@dbsec' as sysdba" @d:\auto\tbs.sql

exit


tbs.sql

set linesize 131
col object format a40
col type format a10
col tsname format a10
select a.owner||'.'||a.segment_name object,
         a.segment_type  type            ,
         a.bytes/1024/1024    NG         ,
         a.next_extent/1024/1024 Next ,
         a.tablespace_name ts_name
    from sys.dba_segments a
where a. next_extent * &num > (
                           select max(b.bytes)
                             from dba_free_space b
                            where a.tablespace_name = b.tablespace_name)
order by 3 desc
/


autoshutdown.bak

conn / as sysdba
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
shutdown immediate;
exit;


autoshutdown.bat

set ORACLE_SID=dt2esd
lsnrctl stop
sqlplus /nolog @d:\auto\autoshutdown.bak
exit
exit


autostartup.bak

conn / as sysdba
startup;
exit;


autostartup.bat

set ORACLE_SID=dt2esd
lsnrctl start
sqlplus /nolog @d:\auto\autostartup.bak
exit
exit


standby db:

autoftpdt2esd.bat

if exist z: then net use U: /delete  /y

net use U: \\10.153.32.95\e$ "Sys!B5dt2zjdb" /user:administrator

U:
cd dt2esd
cd arch
move *.arc e:\dt2esd\arch >>d:\auto\autocopy_dt2esd.log
e:
net use U: /delete /y

set ORACLE_SID=dt2esd

sqlplus /nolog @d:\auto\autoreco.bak >>d:\auto\autoreco_dt2esd.log


exit
exit
exit

autoreco.bak

connect / as sysdba
set autorecovery on
recover standby database;
exit;

autorun.bat

set ORACLE_SID=dt2esd
sqlplus /nolog @d:\auto\autostart_sty.bak
exit
exit

autoshutdown.bak

conn / as sysdba
shutdown immediate;
exit;

autoshutdown.bat

set ORACLE_SID=dt2esd
sqlplus /nolog @d:\auto\autoshutdown.bak
exit
exit


autostart_sty.bak

conn / as sysdba
shutdown immediate;
startup nomount;
alter database mount standby database;

set autorecovery on
recover standby database;
exit;


autostartup.bak

conn / as sysdba
startup nomount;
alter database mount standby database;
exit;


autostartup.bat

set ORACLE_SID=dt2esd
sqlplus /nolog @d:\auto\autostartup.bak
exit
exit

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25198367/viewspace-703894/,如需转载,请注明出处,否则将追究法律责任。

上一篇: linux_db_script
请登录后发表评论 登录
全部评论

注册时间:2011-03-09

  • 博文量
    238
  • 访问量
    300932