DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: hotbackup script run on unix

  1. #1
    Join Date
    Oct 2004
    Posts
    4

    hotbackup script run on unix

    can anyone test the hotbackup script that run on unix platform?Previously the script was run on window platform. Now our server upgraded into unix platform. I already modified the script but there was still detected error during run the script. Can someone help me detect the error and how to solve it?
    Thanks

    Below is the Script context;

    set pagesize 0
    set feedback off
    set linesize 132
    set trimspool on
    set verify off

    #define runfile =G:\xenico\scripts\LOG
    ##define runfile =/se/joctemp/testbk/log
    #define temp =I:\LOG
    ##define temp =/se/joctemp/testbk/log
    #define destination=I:\backup
    ##define destination=/se/joctemp/testbk

    #spool &runfile/backup_db.sql
    spool /se/joctemp/backup_db.sql

    select 'Rem Start time:' || to_char( sysdate, 'dd-mm-yyyy hh24:mi' ) from dual;
    Spool /se/joctemp/testbk/log/backup.log;

    #remark 1
    select 'alter tablespace '||t.name||' end backup;'
    from sys.file$ f, v$backup v, sys.ts$ t
    where v.file# = f.file#
    and f.ts# = t.ts#
    and v.status = 'ACTIVE';

    #remark 2
    alter system switch logfile;

    #remark 3
    #prompt alter database backup controlfile to 'G:\Glovia40\oradata\control.bak';;
    alter database backup controlfile to '/se/joctemp/testbk/control.bak';

    #remark prompt host move G:\Glovia40\oradata\control.bak I:\backup\ >> &temp\hotbackup.log
    #prompt host copy G:\Glovia40\oradata\control.bak I:\backup\ >> &temp\hotbackup.log
    host cp /se/joctemp/testbk/control.bak /se/joctemp/testbk/log/hotbackup.log
    #prompt host del G:\Glovia40\oradata\control.bak >> &temp/hotbackup.log
    host rm /se/joctemp/testbk/control.bak >> /se/joctemp/testbk/log/hotbackup.log

    #remark 4
    alter database backup controlfile to trace;

    #remark 5
    #select 'alter tablespace '||tablespace_name||' begin backup;' || chr(10) ||
    # 'host copy '||file_name||' /se/joctemp/testbk/ >> /se/joctemp/testbk/log/hotbackup.log' || chr(10) ||
    # 'alter tablespace '||tablespace_name||' end backup;' || chr(10)
    #from dba_data_files;

    #remark 5
    select 'alter tablespace '||tablespace_name||' begin backup;' || chr(10) ||
    'host copy '||file_name||' /se/joctemp/testbk/' || chr(10) ||
    'alter tablespace '||tablespace_name||' end backup;' || chr(10)
    from dba_data_files;

    #remark 6
    #prompt host copy G:\orant\database\INITGL42.ORA I:\backup\ >> &temp\hotbackup.log
    host cp /vol01/ora816/dbs/initTEST.ora /se/joctemp/testbk/ >> /se/joctemp/testbk/log/hotbackup.log
    #prompt host copy G:\orant\database\PWDGL42.ORA I:\backup\ >> &temp\hotbackup.log
    ##cp /vol01/ora816/dbs/orapwGL61 /se/joctemp/bk/ >> &temp/hotbackup.log

    #remark 7
    #prompt select file#,status, to_char(time,'DD-MON-YYYY HH24:Mi') TIME from v$backup;
    #prompt select to_char(sysdate,'DD-MON-YYYY HH24:Mi') COMPLETED from dual;
    select file#,status, to_char(time,'DD-MON-YYYY HH24:Mi') TIME from v$backup;
    select to_char(sysdate,'DD-MON-YYYY HH24:Mi') COMPLETED from dual;

    #remark 8
    #prompt alter system switch logfile;
    alter system switch logfile;

    #prompt Spool off;
    #prompt exit;
    Spool off;
    exit;

    set feedback on
    set heading on
    set pagesize 40
    set linesize 80
    exit;
    Last edited by tc.chuah; 05-21-2005 at 02:55 AM.

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    Wheres the script :-)

    and whats the error please oracle server version etc ?

    regards
    Hrishy

  3. #3
    Join Date
    Oct 2004
    Posts
    4
    we are running oracle 8i database on solaris 9i OS.

    this is the error message;

    'ALTERTABLESPACE'||T.NAME||'ENDBACKUP;'
    -----------------------------------------------------------
    0 rows selected.
    Statement processed.
    alter database backup controlfile to '/se/joctemp/testbk/control.bak'
    *
    ORA-01580: error creating control backup file /se/joctemp/testbk/control.bak
    ORA-27038: skgfrcre: file exists
    alter database backup controlfile to trace;
    *
    ORA-00911: invalid character
    'ALTERTABLESPACE'||TABLESPACE_NAME||'BEGINBACKUP;'||CHR(10)||'HOSTCOPY'||FILE_
    --------------------------------------------------------------------------------
    alter tablespace SYSTEM begin backup;
    host copy /se/joctemp/test/system_db.dbf /
    alter tablespace RBS begin backup;
    host copy /se/joctemp/test/rbs_01.dbf /se/joc
    alter tablespace TEMP begin backup;
    host copy /se/joctemp/test/temp_01.dbf /se/j
    alter tablespace DEMO begin backup;
    host copy /se/joctemp/test/DEMO_01.dbf /se/j
    alter tablespace DEMO1 begin backup;
    host copy /se/joctemp/test/DEMO1.dbf /se/jo
    5 rows selected.
    FILE# STATUS TIME
    ---------- ------------------ -----------------
    1 NOT ACTIVE
    2 NOT ACTIVE
    3 NOT ACTIVE
    4 NOT ACTIVE
    5 NOT ACTIVE
    5 rows selected.
    COMPLETED
    -----------------
    20-MAY-2005 16:57
    1 row selected.
    Statement processed.

  4. #4
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    Change the line below

    [code]

    #remark 3
    #prompt alter database
    #backup controlfile to 'G:\Glovia40\oradata\control.bak';;
    alter database backup controlfile to
    '/se/joctemp/testbk/control.bak';

    because the file already exists control.bak at /se/joctemp/testbk
    you need to first delete the file before running the above command.

    regards
    Hrishy

  5. #5
    Join Date
    Oct 2004
    Posts
    4
    hi hrishy

    Thanks for your prompt reply.

    The controlfile may need to overwrite each time perform the hotbackup. so i'll add the remove command in the script before "alter database backup controlfile to '/se/joctemp/testbk/control.bak'".

    Anyway, could you create a database and run the hotbackup script? it just to ensure whether the script can be successfully perform the tasks or not.

    Thanks

  6. #6
    Join Date
    Jan 2001
    Posts
    2,828
    Hi TC

    Sorry i cannot run your hot backup script .Becoz i dont have a spare server at this moment to run that.

    myabe somebody else could give it a try.

    regards
    Hrishy

  7. #7
    Join Date
    Oct 2004
    Posts
    4
    i would be appreciated if someone can test the script.

  8. #8
    Join Date
    Aug 2000
    Location
    Jolo, Sulu
    Posts
    639
    Hi Friend,

    Can I ask why r u not using RMAN utility? The script is just
    very short. Something like:

    rman>
    connect catalog rman/rman@rman
    connect target /
    set snapshot controlfile name to '/u04/RMAN/snapshot1.ctl';
    run
    {
    sql 'alter system archive log current';
    allocate channel d1 type disk;
    backup
    format '/u04/RMAN/%d_al_t%t_s%s_p%p'
    database;
    }

    And presto! it will take care of the entire backup.

    Well, ill try testing ur backup script though,,,but can u send me
    the script on how to restore? Because to be able to say that the
    backup is working, you should be able to restore it

    Last edited by kris123; 05-22-2005 at 09:48 PM.

  9. #9
    Join Date
    Sep 2001
    Location
    Makati, Philippines
    Posts
    857
    host copy could not be a valid command.
    ---------------

  10. #10
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    Reydp nice catch there.You will need to replace host copy with something like

    ! cp

    regards
    Hrishy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width