How to take a Hot backup of Oracle database

  • 1: put the db in archive log mode

    2: set the db_sid to correct one

    3: login to sqlplus

    4: verify the name of the db that you are connected to

    select name from v$database;

    5: check if the db is in archive log made

    select log_mode from v$database;

    if not in archive log mode

    another command to check

    archive log list;

    6: find where on disk oracle writes archive log when it is in archive log mode

    sql> show parameter log_archive_dest_1;

    if the value is found to be 0, that means no values will be recorded, so we need to change it

    sql> alter system set log_archive_dest_1='LOCATION=c:\database\oradata\finance\archived_logs\'

    scope=spfile;

    7: shutdown immediate; < this is done just to prepare the db for hot backups >

    8: startup the db in mount mode

    startup mount;

    ( 3 startup types : nomount - just starts the instance, mount - locates the control files and open up according to the values, open - finds the datafiles from the control files and opens up the db )

    9: put the db in archive log mode

    alter database archivelog;

    10: open the database

    alter database open;

    11: check the status of the db

    select log_mode from v$database;

    SQL> archive log list;

    12: create a directory for archived log

    check if its empty, if empty we need to switch

    sql> alter system archive log current;

    run it 5 times < need to put / and enter > , then check the archive log dir , we will find files

    13: make a table in the database and insert data in it

    create table employees (fname varchar(2));

    check the table

    desc employees;

    insert values

    insert into employees values ('Mica');

    14: tablespace must be in hot backup mode

    check the status

    select * from v$backup;

    if found not active, then we need to change

    we cannot put the db in hot backup mode, unless it is archive log mode

    change to hot backup mode

    alter database begin backup;

    check the status

    select * from v$backup;

    15: now we can only COPY DBF FILES

    copy *dbf <distination location>

    16: need to take the db out to hot backup mode

    alter database end backup;

    17: need to make another archive log switch

    alter system archive log current;

    18: need to copy control files now, need to do a binary bckup

    alter database backup controlfile to '<location>\controlbackup';

    19: insert more values to the table

    insert into employess values ('NASH')

    COMMIT;

    make another archive log switch : alter system archive log current;

    do the same process for more values

    20 : backup all the archive logs to a new location

    21: shutdown the db and simulate a hw error, delete all the files from the database folder

    22: try to start the sqlplus and db ::: error

    23: copy all the backups to the db dir

    need to copy the control files, rename the binary backup of the control file and make the copies as needed

    24: try to mount the db, error < must use reset logs or noreset logs >

    25: need to do a recovering of the database

    shutdown

    restore the archive logs

    startup mount;

    recover database until cancel using backup controlfile;

    it will ask for a log file :

    yes for recovery

    cancel for cancelling recovery

    26: check status: open the database in readonly

    alter database open read only;

    check the tables to see the data

    shutdown immediate

    shartup mount;

    recover again : recover database until cancel using backup controlfile;

    if oracle is asking for a log that do nto exist , all we have to do is type cancel

    27: open the database

    alter database open;

    need to do reset logs

    alter database open resetlogs;

    28: check the db that you are connected, check the tables

    thanks and regards

    VKN

    site admin

    http://www.nitrofuture.com

  • Is there a question here or are you just somewhat shamelessly plugging your Oracle site? You did happen to notice that this is a sql server forum right?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Adding to Sean's comments - post don't even describes an Oracle hot backup as teh title of the thread suggests; most likely the process to test a restore/recover database.

    Is this just spam for the web site on the link?

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply