加一句 
dbms_output.enable(99999);

解决方案 »

  1.   

    还是不行,为什么???我已经在代码的第一行加上这个语句了。修改后的代码如下所示:
    (执行语句时,我已经用了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;
      

  2.   

    在把
    exec dbms_output.enable(9999999);
    再放大些。
      

  3.   

    郁闷中,还是不行。我已经把exec dbms_output.enable(999999999999999999);加很大了。
    我的系统是8.1.7.4.1
      

  4.   

    create or replace procedure outtablespace as
      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