How to take a Hot backup of Oracle database [message #548872] |
Mon, 26 March 2012 15:12 |
|
nathanz
Messages: 1 Registered: March 2012
|
Junior Member |
|
|
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
[EDITED by LF: removed suspicious SPAM URL]
[Updated on: Mon, 26 March 2012 15:19] by Moderator Report message to a moderator
|
|
|
|
|