Oracle generates lots of .dbf files - oracle

When I arrived at the office this morning, our Oracle 10.2 server was out of disk space. On closer inspection I found that about 1 to 4 or more .dbf files are generated once a minute (e.g. 1_1278092_658232789.dbf, 1_1278093_658232789.dbf, etc.). I created a bit of space, but Oracle still creates these files without deleting the old ones. It seems to have started about 35 hours ago. How do I restore the server to normal. Please note that I am not an Oracle DBA and have limited Oracle knowledge.
Edit 1:
First, I manage to clear about 270GB of space with the following, which allowed the server to keep running:
RMAN> CROSSCHECK BACKUP;
RMAN> DELETE ARCHIVELOG ALL;
To answer ora-600's questions:
In which path does Oracle create those files?
/home/oracle/archive/
(which is also the value of log_archive_dest_1)
DB_CREATE_FILE_DEST (parameter for datafiles)
This does not seem to have been set ("show parameter DB_CREATE_FILE_DEST" shows no value), but the database files are in
/home/oracle/app/oracle/product/oradata/irs3
DB_RECOVERY_FILE_DEST (parameter for FRA) -- which sub directory?
sys#iris > show parameter DB_RECOVERY_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /home/backup
db_recovery_file_dest_size big integer 2500G
I suspect that these are flashback logs. If so you should limit the flash recovery area (FRA) by setting the parameter DB_RECOVERY_FILE_DEST_SIZE to a smaller value. Oracle keeps writing flashback logs until the FRA is out of space... then it stats removing/overwriting old files.
Wel, the previous DBA did set this to a very high value and now it is full. E.g. look at:
sys#iris > SELECT NAME, (SPACE_LIMIT/1024/1024) || 'MB' AS SPACE_LIMIT,
((SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE)/1024/1024) || 'MB' AS SPACE_AVAILABLE,
ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)
AS PERCENT_FULL
FROM V$RECOVERY_FILE_DEST;
NAME SPACE_LIMIT SPACE_AVAILABLE PERCENT_FULL
/home/backup 2560000MB 940MB 100
But RMAN now spits errors like these in its log files:
....
input archive log thread=1 sequence=1278543 recid=1271197 stamp=866048159
input archive log thread=1 sequence=1278544 recid=1271198 stamp=866048232
channel ORA_DISK_1: starting piece 1 at 11-DEC-14
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/11/2014 22:07:20
ORA-19809: limit exceeded for recovery files
ORA-19804: cannot reclaim 2691888128 bytes disk space from 2684354560000 limit
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1278907 recid=1271561 stamp=866062135
....
Even though there is space on the drive:
-bash-3.2$ df -h
Filesystem Size Used Avail Use% Mounted on
....
/dev/vg01/lvol1 684G 365G 317G 54% /home
Why does the query above give the space as full, even though there are space available on the drive?
Below is more info, if needed.
Thanks.
Nico
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/backup/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/app/oracle/product/10/dbs/snapcf_irs3.f'; # default

Thanks for the details that helps to identify the problem.
I think you have 2 problems.
1st problem is the database keeps creating theese small .dbf files. This is not a problem but the files need to be dealt with correctly. These files are called "archivelogs". When a database is in archivelog mode (required for online backup) it creates a copy of a redolog every time is full. During your daily backup you should backup and delete archivelogs.
2nd problem lots of reclaimable space in the FRA.
The FRA has a logical limit which is expressed by DB_RECOVERY_FILE_DEST_SIZE. When oracle creates a file in the FRA it is registered in the controlfile as well. This means you have to delete files from the FRA always with rman. I think you know this since you deleted archivelogs with rman and not with "rm -f".
Your query showed 100% as a result of: (SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100
This means all files in the FRA are reclaimable. They might don't even exist physically what means they are expired. 2nd option is they exist but they are obsolete according to the "RETENTION POLICY TO REDUNDANCY 1" rule.
Solution:
I think you should adjust the backup concept a bit.
a) First of all run the following rman commands:
crosscheck archivelog all;
crosscheck backup;
delete noprompt expired archivelog all;
delete noprompt expired backup;
delete obsolete;
b) Configure the parameter DB_RECOVERY_FILE_DEST_SIZE to an appropriate value. It depends on how many databases you have on the server and how much space is used from the /home directory for other stuff. I would say choose a value between 300GB and 600GB.
c) Adjust the backup scripts:
RMAN should run the commands mentioned in a) in the daily backup job.
With this setup you never should have much reclaimable space in the FRA (except you enabled flashback functionality -- check with "select flashback_on from v$database;").
Maybe you have to adjust some of the following commands but this is a default rman script which includes self cleaning:
crosscheck archivelog all;
backup database;
backup archivelog all delete input;
crosscheck backup;
delete noprompt expired archivelog all;
delete noprompt expired backup;
delete obsolete;
This backup script cleans up expired entries from the controlfile, backs up archivelogs + deletes them and deletes old backups which are no longer needed.
To tell rman which backups are no longer needed configure the RETENTION POLICY. I prefer a recovery window than redundancy:
RMAN> CONFIGURE RETENTION POLICY TO recovery window of 2 days;

In which path does Oracle create those files?
- DB_CREATE_FILE_DEST (parameter for datafiles)
- DB_RECOVERY_FILE_DEST (parameter for FRA)
-- which sub directory?
I suspect that these are flashback logs. If so you should limit the flash recovery area (FRA) by setting the parameter DB_RECOVERY_FILE_DEST_SIZE to a smaller value. Oracle keeps writing flashback logs until the FRA is out of space... then it stats removing/overwriting old files.

Related

Rman bash script with cronjob

i have a rman bash script which works when i execute it (./backup.sh).
but when i use cronjob, it doesn't work.
My scripts is as follows
backup.sh
rman target / #backup.rcv log=rman.log
backup.rcv
backup format '/backup/rman/backup/%U.arch.rman' filesperset 2 archivelog all delete input; backup format '/backup/rman/backup/%U.datafiles.rman' filesperset 2 incremental level 0 database; backup format '/backup/rman/backup/%U.arch.rman' filesperset 2 archivelog all delete input; backup format '/backup/rman/backup/%U.ctl.rman' current controlfile; delete noprompt obsolete;
my cronjob looks somthing like this
crontab -l
5 0 * * * /nas_backup/rman/svbo/backup/L0backup.sh >/dev/null 2>&1
i am very new to this rman and bash script so any help would be appreciated
inorder for this to be fixed replace the code in your "L0backup.sh"
with
#!/bin/bash
#
export ORACLE_SID=your-sid
export ORACLE_HOME=your-oracle-home
$ORACLE_HOME/bin/rman target / nocatalog <<EOF
backup format '/nas_backup/rman/backup/%U.arch.rman' filesperset 2 archivelog all delete input;
backup format '/nas_backup/rman/backup/%U.datafiles.rman' filesperset 2 incremental level 0 database;
backup format '/nas_backup/rman/backup/%U.arch.rman' filesperset 2 archivelog all delete input;
backup format '/nas_backup/rman/backup/%U.ctl.rman' current controlfile;
delete noprompt obsolete;
EOF
to get your ORACLE_SID and ORACLE_HOME
you can echo it out like
#echo $ORACLE_SID
your-sid
# echo $ORACLE_HOME
your-oracle-home
next to set your crontab - lets say you want the above file to run every midnight (Crontab Guru)
#crontab -e
5 0 * * * /bin/bash /nas_backup/rman/backup/L0backup.sh > /nas_backup/rman/backup/rman.log 2>&1
if you notice your output gets loged to "rman.log".
furthermore you can now delete your "backup.rcv" file as its no longer being used.
Step 01. Create a backup script with the following content (modified it as your desire)
#!/bin/sh
#
# Run as: oracle
#
export ORACLE_SID=orcl
export ORACLE_HOME=/oradb/oraclebase/dbhome
rman target / << EOI
# Allocating channels (should equal number of physical CPU #lscpu)
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
# change into the highest rate compression - required license
CONFIGURE COMPRESSION ALGORITHM 'HIGH' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD FALSE;
# validate physical existence of backupset & copy
CROSSCHECK BACKUPSET;
CROSSCHECK COPY;
# removing metadata of "EXPIRED" info from the catalog
DELETE NOPROMPT EXPIRED BACKUPSET;
DELETE NOPROMPT EXPIRED COPY;
# Backup full database (incremental level 0) on Sunday
BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE FORMAT '/backup/%d_full_level_0_%U.bak';
#incremental level 1 on the other days not Sunday
#enabling block change tracking if you want level 1 goes fast
#BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 DATABASE FORMAT '/backup/%d_full_level_1_%U.bak';
# Backup archivelog log
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL DELETE INPUT FORMAT '/backup/%_ARCHIVE_%U.bak';;
# Clean obsolete backups depending on setting of retention policy
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
DELETE NOPROMPT OBSOLETE;
# Allocated channel will release automatically ;)
exit
EOI
exit
Step 02: Change owner & permission
Step 03: Set crontab job for that script.

RMAN backups error while creating full & incremental backups

We have our oracle instance running on windows server & when configured RMAN to take the backups we are seeing following error in the logs,
Error Details:
channel ch1: starting piece 1 at 07-MAY-17
channel ch1: finished piece 1 at 07-MAY-17
piece handle=\\backup_share\FULL_db01_20170507.BAK tag=COMPLETE_BACKUP comment=NONE
channel ch1: backup set complete, elapsed time: 02:10:37
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 07-MAY-17
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ch1 channel at 05/07/2017 23:10:45
ORA-19504: failed to create file "\\backup_share\FULL_db01_20170507.BAK"
ORA-27038: created file already exists
OSD-04010: <create> option specified, file already exists
RMAN Command Script:
run{
Allocate channel ch1 type disk format '\\backup_share\full_%d_%T.bak';
Backup incremental level=0 database tag='complete_backup';
Release channel ch1;
Allocate channel t1 type disk format '\\backup_share\ctrl_%d_%T';
Backup current controlfile;
Release channel t1;
}
I see same kind of logging when trying to take incremental backups. Could someone help me with this issue?
[oracle#orcluat ~]$ oerr ora 27038
27038, 00000, "created file already exists"
// *Cause: trying to create a database file, but file by that name already
// exists
// *Action: verify that name is correct, specify reuse if necessary
%d format specifies the name of the database and %T specifies the year, month, and day in the Gregorian calendar in this format: YYYYMMDD. It is also being reflected in your backup file name, FULL_db01_20170507.BAK. There might have files with the same name.
Better to use %U in your file name format which specifies a system-generated unique filename.
Documentation:
formatSpec

Oracle 10g: Error when creating database manually by scripts

My situation is that I have to create a new Oracle database using only scripts (so please do not advice me using DBCA)
My script is as below:
CreateDB.bat
set ORACLE_SID=testdb
oradim -new -sid %ORACLE_SID% -intpwd test -startmode M
copy init.ora D:\oracle\product\10.2.0\db_1\database\inittestdb.ora
sqlplus sys/test as sysdba #D:\Script\CreateDB.sql
==> "init.ora" is the file I copy from the DB created using DBCA
CreateDB.sql
CREATE SPFILE='D:\oracle\product\10.2.0\db_1\dbs\spfiletestdb.ora' FROM
PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
startup nomount PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
create database testdb
logfile group 1 ('D:\oracle\product\10.2.0\oradata\testdb\redo1.log') size 100M,
group 2 ('D:\oracle\product\10.2.0\oradata\testdb\redo2.log') size 100M,
group 3 ('D:\oracle\product\10.2.0\oradata\testdb\redo3.log') size 100M
character set JA16SJIS
national character set AL16UTF16
datafile 'D:\oracle\product\10.2.0\oradata\testdb\system01.dbf'
size 500M
autoextend on
next 100M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\product\10.2.0\oradata\testdb\sysaux01.dbf'
size 100M
autoextend on
next 100M
maxsize unlimited
DEFAULT TABLESPACE tbs_1
DATAFILE 'D:\oracle\product\10.2.0\oradata\testdb\tbs01.dbf'
SIZE 200M REUSE
DEFAULT temporary TABLESPACE tempts1
tempfile 'D:\oracle\product\10.2.0\oradata\testdb\temp01.dbf'
SIZE 200M REUSE
undo tablespace undotbs
datafile 'D:\oracle\product\10.2.0\oradata\testdb\undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
The above return error [ORA-30012: undo tablespace 'UNDOTBS01.DBF' does not exist or of wrong type].
At first, as i check the init.ora file, I found out that the parameter for UNTO tablespace have different name for UNDO file, so I change it to match the file name in my script.
Old:
undo_management=AUTO
undo_tablespace=UNDOTBS1.DBF
New:
undo_management=AUTO
undo_tablespace=UNDOTBS01.DBF
and delete the database (yes, even when error, the database is still created, just cannot be used) and re-run everthing again, and same error occurs.
I have research for 2 days and still cannot find any solution.
All the script above is following the guide on Oracle website:
http://docs.oracle.com/cd/B19306_01/server.102/b14231/create.htm
The OS is Windows Server 2003.
Database is Oracle 10g Standard Edition.
UPDATED 1:
Thank Mat, UNDO tablespace problem is solved :D
Now, next error pop-up.
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMPTS1
Wed May 21 09:11:38 2014
Errors in file d:\oracle\product\10.2.0\admin\testdb\udump\testdb_ora_3416.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-02236: invalid file name
However, it is actually due to the missing of datafile option for [DEFAULT TABLESPACE tbs_1].
I have update the CREATE script above.
UPDATED 2:
A new problem occurred when I create a user for this database.
I have created a new topic for it on this link:
Oracle 10g: ORA-12154 when connect to database with newly created user
Any help will be appreciated.
The undo_tablespace parameter takes the name of the tablespace, not of the datafile.
You should have
undo_tablespace=UNDOTBS
in your parameter file to match your database creation script.

specification does not match any backup in the repository

i want to delete arhcivelog on my DB oracle.
RMAN> list backup of archivelog all;
specification does not match any backup in the repository
it seems there is not any of them.
but the recovery area is not empty.
SELECT * FROM V$RECOVERY_FILE_DEST;
name space_limit space_used space_reclaimable number of files
/opt/oracle/recovery_area 21474836480 10529677312 0 8
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2081
Current log sequence 2083
what's wrong in my oracle? how to delete all archivelog?
Thanks a lot.
Delete all archivelog on disk no matter wether they are backed up or not
RMAN > delete archivelog all;
Delete all archivelog on disk no matter wether they are backed up or not having one day old.
RMAN > delete archivelog all completed before ‘sysdate -1′;

How to import a Oracle 11g RMAN backupset on a new database server?

I have got a backupset of an Oracle 11g database which was created with RMAN. Now I want to import/restore the backupset onto a new and empty database server. I know that the command to create the backupset was
run {
backup as compressed backupset database
tag "FULLBACKUP"
format "/orabackup/rman/backup/FULL_%d_%T_%U";
backup as compressed backupset archivelog all
tag "ARCHIVELOGS"
format "/orabackup/rman/backup/ARCH_%d_%T_%U"
delete all input;
}
but I cannot find out how to make the files produced by this command known to RMAN on my new database server and import the backupset using RESTORE/RECOVER.
I never used this tool, but i google a few minutes any maybe this will help you...
Direct Link: RMAP Import
Here is the script I use to restore the database from the backup, (I always clean up the database before restoring it.)
* Startup nomout;
* Set dbid xxxxxxxx // This is the dbid of your database
* Run {
Set controlfile autobackup format for device type disk to ''; // e.g. '/ora101/oradata/TAR/%F'
Restore controlfile from autobackup;
}
* Alter database mount; // can't restore without the database mounted
* Restore database; // can't run recover without first restore
* Recover database; // if the backup was from incremental, RMAN will try to apply all the logfiles generated after the backup was started.
* Alter database open resetlogs;
// EDIT: Here is another link from the OraFaq.
One other method to use is to restore the control file(s) from a backup.
Startup no mount;
run {
allocate channel device type disk;
restore from '/u01/......';
}
At this point i would shutdown and startup mount. (Make sure the pfile/spfile have the correct entries for the controlfile names and location)
once in mount mode enter the command
catalog start with '/u01/.....' (The controlfile backup should be a good place to start)
You will be asked if you want to add the information from the file. Also this can be repeated for any backuppiece you have.
Now if you do a list backups you should see all the items from you orignal rman backup and then start the process of restoring/recovering the database.
Disclaimer: The commands are taken from memory so the syntax might not be 100% correct but a quick google of it should put you on the right track.
EDIT:
To get the datafiles to be renamed you migh find this command useful. It puts data files into ASM but you should be able to go the other way by replacing the +DATA with the correct datafile name and location
run
{
set newname for datafile 1 to "+DATA";
set newname for datafile 2 to "+DATA";
set newname for datafile 3 to "+DATA";
set newname for datafile 4 to "+DATA";
set newname for datafile 5 to "+DATA";
restore database;
switch datafile all;
recover database
}

Resources