加一句
dbms_output.enable(99999);
dbms_output.enable(99999);
解决方案 »
- 新手问题:为什么用户只分配了connect权限,但可以sysdba登录
- 当count(字段)为空时怎么用0代替????
- 为什么建了同义词却在应用时候总是出错误,总是识别不出来呢?
- 如何将ACCESSXP中内容导入ORACLE中
- 谁可以帮我把下面的程序转化为plsql程序,着急,多谢
- oracle中decode()函数在mysql中怎么改啊,在线等!
- 赛扬2 能装oracle 9i吗
- Oracle8跟8i有什么区别?oracle9又有什么新的优点?
- linux中安装oracle11g,安装dbca时遇到问题,求解决
- ORACLE cast函数 将日期转换为字符串问题
- 经常用到的语句,可有一点我不明白?
- 在P/L SQL中,怎样获知当前Database名称?
(执行语句时,我已经用了connect internal/oracle as sysdba用户登陆)exec dbms_output.enable(99999);
set feedback off pagesize 0 heading off verify off linesize 100 trimspool on
define dir='f:\hot_backup\zpxyy\'
define fil='f:\hot_backup\opened_backup_command1.sql'
define spo='&dir\opened_backup_output.lst'
prompt *** spooling to &fil
set serveroutput on
spool &fil
prompt spool &spo
prompt archive log list;;
prompt alter system switch logfile;;
declare
cursor cur_tablespace is
select tablespace_name from dba_data_files order by file_id;
cursor cur_datafile (tn varchar) is
select file_name from dba_data_files where tablespace_name=tn;
begin
for ct in cur_tablespace loop
dbms_output.put_line('alter tablespace '||ct.tablespace_name||' begin backup;');
for cd in cur_datafile (ct.tablespace_name) loop
dbms_output.put_line('host copy '||cd.file_name||' &dir');
end loop;
dbms_output.put_line('alter tablespace '||ct.tablespace_name||' end backup;');
end loop;
end;
/
prompt alter system switch logfile;;
prompt alter database backup controlfile to '&dir\controlfile.ctl' REUSE;;
prompt archive log list;;
prompt spool off;;
spool off;
exec dbms_output.enable(9999999);
再放大些。
我的系统是8.1.7.4.1
cursor cur_tablespace is
select tablespace_name from dba_data_files order by file_id;
cursor cur_datafile (tn varchar) is
select file_name from dba_data_files where tablespace_name=tn;
begin
for ct in cur_tablespace loop
dbms_output.put_line('alter tablespace '||ct.tablespace_name||' begin backup;');
for cd in cur_datafile (ct.tablespace_name) loop
dbms_output.put_line('host copy '||cd.file_name||' d:\');
end loop;
dbms_output.put_line('alter tablespace '||ct.tablespace_name||' end backup;');
end loop;
end;---------------------------------------
SQL> execute outtablespace;PL/SQL procedure successfully completedSQL> set serveroutput on;
SQL> execute outtablespace;
alter tablespace SYSTEM begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\SYSTEM01.DBF d:alter tablespace SYSTEM end backup;
alter tablespace RBS begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\RBS01.DBF d:alter tablespace RBS end backup;
alter tablespace USERS begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\USERS01.DBF d:alter tablespace USERS end backup;
alter tablespace TEMP begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\TEMP01.DBF d:alter tablespace TEMP end backup;
alter tablespace TOOLS begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\TOOLS01.DBF d:alter tablespace TOOLS end backup;
alter tablespace INDX begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\INDX01.DBF d:alter tablespace INDX end backup;
alter tablespace DRSYS begin backup;
host copy D:\ORACLE\ORADATA\ORACLE\DR01.DBF d:alter tablespace DRSYS end backup;PL/SQL procedure successfully completed