Drop datafile from a offline tablespace
We are running oracle 9.2 on windows.
Out of the 3 datafiles in a non-system tablespace A, one datafile A-DF1 was accidently droped from the file system by our DBA.
The other two datafiles were brought online by using the ALTER DATABASE RECOVER command by bringning the database in mount phase.
Now we want to remove that datafile A-DF1 from the tablespace and bring that tablespace online.
The database is not in archive mode and no cold backup was present.
The solution that we want to try is:
1-drop the tablespace A without dropping the datafiles
2-create a new tablespace and reuse those datafiles
3-assign this new tablespace to the affected user
Would this work? Do you have any other safe solution for this problem?
thanks
Imran
Hi..
Your solution is a wrong solution.
1. I guess, that the tablespace A won't be a empty tablespace.As, the objects are present in the tablespace you can't drop the tablespace without dropping its contents.You will have to use *DROP TABLESPACE <tbs_name> INCLUDING CONTENTS; -- This will drop all the contents.
2. Do, you have a export backup, or any kind of backup.As the database is in no archivelog mode, you won't be able to do complete recovery.
3. Take the datafile A-DF1 OFFLINE and keep the tablespace online. -- alter database datafile 'datafile_name' offline;
If you don't have any kind of backup, the data is LOST.
Anand
Similar Messages
-
Need to drop datafile from my undo tablespace
I have a undo tablespace and it has 2 datafiles. i would like to drop one datafile.
befor i am droping this datafile i am going to bring this file to offline and i got this message: ORA--01145 offline immediate disallowed unless media recovery enable.
can someone tell me how i can safly do it without any problem.
ThanksAn undo tablespace can be dropped like any other tablespace, but not until all transactions within the tablespace are complete. First, specify a new undo tablespace as in the previous example. To see if the tablespace has any pending transactions, run the following query:
SQL> select rn.name, rs.status
2 from v$rollname rn, v$rollstat rs
3 where rn.name in
4 (select segment_name from dba_segments
5 where tablespace_name = 'UNDOTBS')
6 and rn.usn = rs.usn
7 ; -
DROP DATAFILE FROM A TABLESPACE
What is the difference between "ALTER TABLESPACE DROP DATAFILE ..." and "ALTER DATABASE DATAFILE ... OFFLINE DROP"?
I read the Oracle document before, it tolds me that the "ALTER DATABASE DATAFILE ... OFFLINE DROP" is not really drop data file. But, does the "ALTER TABLESPACE DROP DATAFILE ..." really drop data file?"ALTER DATABASE DATAFILE ... OFFLINE DROP"
will take datafile offline to drop it later. In this case your control file will need to be recreated to de-link the datafile from database.
From 10g onwards you can ALTER TABLESPACE DROP DATAFILE... but in this case datafile should not contain any data in it. -
I'm new to oracle.
After I extended a tablespace I understood that it was too large.
I've been reading about how to drop a tablespace, but I don't want to drop the entire tablespace. I just want to drop the last datafile of this tablespace.
I know how to drop tablespaces in sapdba and brtools, but I don't know how I can drop one specific datafile (number 29) of the tablespace PSAPBTABD?
Please Help med.
Best regards
Harald VHello Harald,
see please this thread:
Re: How to drop data file?
also the section 43. <i>How can I delete a data file that was created by mistake</i>
in the SAP Note<i><b> 592393 - FAQ: Oracle</b></i>
if you have Oracle 9i databases, it is not easy to drop a datafile, but in Oracle 10g
you can drop a datafile like that:
<b><i>ALTER TABLESPACE</i></b> <<u><i>Tablespace Name</i></u>> <b><i>DROP DATAFILE</i></b> '<<u>PATH und NAME of Datafile</u>>';
for example, you have a tablespace called PSAPC11 and you want to drop a datafile called dat.data15 of this tablespace, you can drop it like that:
e.g. <b><i>alter tablespace</i></b> <u>PSAPC11</u> <b><i>drop datafile</i></b> <u>'/oracle/C11/psapc11/dat.data15'</u>
Best regards
Baran -
Question about ALTER TABLESPACE add/drop datafile
Good afternoon,
As an exercise, I created a tablespace STORETABS and added a datafile to it using the command:
SQL> alter tablespace storetabs add datafile 'e:/storetabs3.dbf' size 50M;This step succeeded. A new file was created in the root of e: as expected.
Following that command, I issued:
SQL> alter tablespace storetabs drop datafile 'e:/storetabs3.dbf';
Tablespace altered.The command succeeded. However, the file *'e:/storetabs3.dbf'* was not removed. After re-reading the documentation found at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3002.htm, I get the impression that removing the O/S file itself is something that always needs to be done manually.
The question: Am I correct that there is no option to cause the "alter tablespace <tablespace> drop datafile <datafilename>" to delete the O/S file ? In other words, must the O/S file always be manually deleted as a separate step ?
Thank you for your help,
John.I believe in windows directory paths used backslash and not forward slash.
You can argue why oracle does not give error, either while creating or while dropping ;)
SQL> select * from v$version ;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> select tablespace_name, file_name from dba_data_files ;
TABLESPACE_NAME
FILE_NAME
USERS
/u01/app/oracle/oradata/orcl/users01.dbf
UNDOTBS1
/u01/app/oracle/oradata/orcl/undotbs01.dbf
SYSAUX
/u01/app/oracle/oradata/orcl/sysaux01.dbf
SYSTEM
/u01/app/oracle/oradata/orcl/system01.dbf
EXAMPLE
/u01/app/oracle/oradata/orcl/example01.dbf
SCOTT_TBS
/home/oracle/scott_f1.dat
6 rows selected.
SQL> !ls -l scott_f1.dat
-rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat
SQL> alter tablespace scott_tbs add datafile '/home/oracle/scott_f2.dat' size 10M ;
Tablespace altered.
SQL> !ls -l scott_*.dat
-rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat
-rw-r----- 1 oracle oinstall 10493952 Sep 11 21:18 scott_f2.dat
SQL> alter tablespace scott_tbs drop datafile '/home/oracle/scott_f2.dat' ;
Tablespace altered.
SQL> !ls -l scott*.dat
-rw-r----- 1 oracle oinstall 276832256 Sep 11 21:15 scott_f1.dat -
Hello all,
I have a database 11.1.0.7 where I wanted to remove a datafile. The database is in archivelog.
The first thing that I did was to make sure that no data was in the datafile. - OK
Then, since I only wanted to remove 1 week later, I put the datafile offline - OK
On the day (one week after putting it offline) that I was going to remove/drop the datafile from the tablespace I got an ORA- saying to put the datafile online before dropping.
And here is my problem! The database says that the datafile needs recover :(
Questions:
1- If the datafile was offline, why does it need recover?
2- Do you thing that the database will ask for all archivelogs until now to recover this datafile ?
3- If I dont want to apply all archivelogs, can I simply remove the datafile by recreating the controlfile without this datafile?
Thank you.Questions:
1- If the datafile was offline, why does it need recover?The SCN must be alligned with the DB
2- Do you thing that the database will ask for all archivelogs until now to recover this datafile ?I never tried that with missing archived logs so I cannot say it. Just try and you will see.
3- If I dont want to apply all archivelogs, can I simply remove the datafile by recreating the controlfile without this datafile?The problem is that this datafile is registered in the dictionary. You cannot do it.
Probably you got this exception:
ORA-03264: cannot drop offline datafile of locally managed tablespace
Cause: Trying to drop offline datafile in lmts
Action: Try to drop file after making it onlinehttp://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dfiles006.htm#ADMIN11435
Restrictions for Dropping Datafiles
The following are restrictions for dropping datafiles and tempfiles:
- The database must be open.
- If a datafile is not empty, it cannot be dropped.
- If you must remove a datafile that is not empty and that cannot be made empty by dropping schema objects, you must drop the tablespace that contains the datafile.
- You cannot drop the first or only datafile in a tablespace.
- This means that DROP DATAFILE cannot be used with a bigfile tablespace.
- You cannot drop datafiles in a read-only tablespace.
- You cannot drop datafiles in the SYSTEM tablespace.
- If a datafile in a locally managed tablespace is offline, it cannot be dropped. -
Hi all,
You will say this guy have so many qusetions... but when I try my level best to get the answer from searchin on internet.. some books and by asking other people.. and when I don't get satisfied answer, I always choose OTN....
Right now I have a question and this is related to live secnario...
My table is partitioned and each partition is placed in different tablespace. There are 12 partitions which holds the data for each quarter of every year. So if I take the tablespace that belongs to year 2004 and 2005 OFFLINE, and fire the query to SELECT data from that table, will ORACLE ignore the data read from the OFFLINE tablespaces?
In other words, I want to know, does Oracle ignores read from the offline tablespaces?
Your answer will really help me to proceed with my activity!
Thanks in advance
Himanshu DabirFew corrections:
He said, he able to extract the value from the offline tablespace, which is not possible, everybody knows, he definetly getting it from shared pool, that's why Isuggested him to flush shared pool, so the next time, he would definatly not goint to get it.
For your kind information, data blocks are kept in the bufer cache not in shared pool as you think.
Also, I guess, when you make datafile offline, not with immediate option, oracle must updates its datafile header with the offline status flag and data block belonging might be flushed back to disk from the buffer cache.
This is for the original poster:
when your query criteria is not going to access data from those offlne datafiles, why the hell you wanna bring those datafile to offine? I dont see anymeaning of it.
for any specific reasons doing so?
You may make them to read only in order to avoid getting ORA errors, in case of accessing data from those datafiles.
Jaffar -
ORA-03264: cannot drop offline datafile of locally managed tablespace
Hi list
A datafile was acidentally created on filesystem in one node of two nodes RAC.
After that the filesystem on which the datafile was created was out of space because of automatic control file backup and sysadmin move this datafile to another device. And before this action RMAN backup stopped work.
Now we replace the datafile to the original location, but it stay offline and recover status, and we cant bring them online because the customer dont have necessary archive logs to recover this datafile. RMAN backup is now working. But now we need to create a DataGuard on a third server and want to drop this datafile.
This datafile dont have any data segment and stay in most critical tablespace of the customer application which have more datafiles. This datafile in question isnt the first datafile of the tablespace.
SQL> select file#, status from v$datafile where name='/oracle/product/db/ars/dbs/arsystem.old';
FILE# STATUS
21 RECOVER
SQL> select file#, status from v$datafile_header where name='/oracle/product/db/ars/dbs/arsystem.old';
FILE# STATUS
21 OFFLINE
How can I drop this datafile?
Thanks
CristianoReview this metalink note, what to do:
How to 'DROP' a Datafile from a Tablespace
Doc ID:111316.1
If you cannot recover the datafile, you have to export the 'rest' of the tablespace (after statement 'alter database datafile '/oracle/product/db/ars/dbs/arsystem.old' offline drop;' was successfully issued). Afterwards drop the tablespace,recreate it and import the data).
Werner -
Drop one datafile from Tablespace
Hi,
I have 9i Database on Linux. I want to drop one datafile from tablespace. I have tried to drop datafile through following command but it gave no effect.
alter database datafile <datafile name> offline drop;
What should i have to do for dropping datafile?
Do the needful
Thankx in advance.Hi
since you dont specify the database version or if you have it setup as archivelog or noarchivelog mode, i paste the drop specs for dropping a datafile, from SQL Reference manual of 9i
DROP If the database is in NOARCHIVELOG mode, you must specify the DROP
clause to take a datafile offline. However, the DROP clause does not remove the
datafile from the database. To do that, you must drop the tablespace in which the
datafile resides. Until you do so, the datafile remains in the data dictionary with the
status RECOVER or OFFLINE.
If the database is in ARCHIVELOG mode, Oracle ignores the DROP keyword.
Regards
Message was edited by:
pcambra -
Create standby having offline dropped datafile .
Hi,
How to deal with offline dropped datafiles on source when creating standby .
I've 4 node rac, and one tablespace offline and related bigdatafile droped offline (because of corruption).
SQL> select tablespace_name , status from dba_tablespaces order by status ;
TABLESPACE_NAME STATUS
OLD_TBS OFFLINE
SQL> select TS#,STATUS,ENABLED from v$datafile order by status;
TS# STATUS ENABLED
16 OFFLINE DISABLED
Its 4 node RAC 10.2.0.3 and ASM .
select name,TS#,STATUS,ENABLED from v$datafile order by status
+DBG1/dbname/datafile/bigfile.279.615031073
Currently I'm doing something like that
rman target /
catalog backuppiece '/oarch/backup/bigfile.279.615031073';
run{
allocate channel ch1 type disk;
SET NEWNAME FOR DATAFILE 16 TO '+DBG1';
restore datafile 16 from tag='TAG20100209T124507';
SWITCH DATAFILE 16;
release channel ch1;
and then after duplicate is end
SQL> alter database datafile 16 offline drop;
SQL> recover automatic standby database;Please advice.
Regards
GregGHi GregG,
I think there is no requirement to file the request with Oracle. :-) Please check the below testcase where I tried to simulate the scenario this time by using RMAN.
Primary Database: oraprd
Physical Standby database: oraphy
SYS @ oraprd>select tablespace_name,file_id from dba_data_files;
TABLESPACE_NAME FILE_ID
SYSTEM 1
SYSAUX 2
UNDOTBS1 3
USERS 4
TEST 5
SYS @ oraprd>select TS#,file#,STATUS,ENABLED from v$datafile order by status;
TS# FILE# STATUS ENABLED
6 5 OFFLINE DISABLED
1 2 ONLINE READ WRITE
2 3 ONLINE READ WRITE
4 4 ONLINE READ WRITE
0 1 SYSTEM READ WRITEConfigure catalog (controlfile) to exclude an offline tablespace TEST and perform the full database backup with standby control file
C:\>rman target sys/abc123@oraprd
connected to target database: ORAPRD (DBID=2633932676)
RMAN> configure exclude for tablespace 'TEST';
using target database control file instead of recovery catalog
Tablespace TEST will be excluded from future whole database backups
new RMAN configuration parameters are successfully storedprimary database backup with standby control file
RMAN> run{
2> allocate channel d1 type disk;
3> allocate channel d2 type disk;
4> backup database format 'c:\temp\rman_oraprd_%U.bkp';
5> backup archivelog all format 'c:\temp\rman_arch_%U.bkp';
6> backup current controlfile for standby format 'c:\temp\rman_standby_%U.bkp';
7> }
released channel: ORA_DISK_1
allocated channel: d1
channel d1: SID=9 device type=DISK
allocated channel: d2
channel d2: SID=143 device type=DISK
Starting backup at 15-JUN-12
file 5 is excluded from whole database backup <===
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=C:\APP\XYZ\ORADATA\ORAPRD\ORAPRD\DATAFILE\O1_MF_SYSTEM_DATA_D-ORA11PRD_I-2924940358_TS-SYSTEM_FNO-1_07NDBK6A_.DBF
input datafile file number=00003 name=C:\APP\XYZ\ORADATA\ORAPRD\ORAPRD\DATAFILE\O1_MF_UNDOTBS1_DATA_D-ORA11PRD_I-2924940358_TS-UNDOTBS1_FNO-3_0ANDBK7H_.DBF
channel d1: starting piece 1 at 15-JUN-12
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=C:\APP\XYZ\ORADATA\ORAPRD\ORAPRD\DATAFILE\O1_MF_SYSAUX_DATA_D-ORA11PRD_I-2924940358_TS-SYSAUX_FNO-2_08NDBK6A_.DBF
input datafile file number=00004 name=C:\APP\XYZ\ORADATA\ORAPRD\ORAPRD\DATAFILE\O1_MF_USERS_DATA_D-ORA11PRD_I-2924940358_TS-USERS_FNO-4_09NDBK6B_.DBF
channel d1: specifying datafile(s) in backup set
including standby control file in backup set
channel d1: starting piece 1 at 15-JUN-12
channel d1: finished piece 1 at 15-JUN-12
piece handle=C:\TEMP\RMAN_STANDBY_0VNDJJR2_1_1.BKP tag=TAG20120615T123858 commen
t=NONE
channel d1: backup set complete, elapsed time: 00:00:03
Finished backup at 15-JUN-12
released channel: d1
released channel: d2
RMAN> exitBuild the physical standby database using RMAN
C:\>rman target sys/abc123@oraprd auxiliary sys/abc123@oraphy
connected to target database: ORAPRD (DBID=2633932676)
connected to auxiliary database: ORAPRD (not mounted)
RMAN>
RMAN> run{
2> allocate auxiliary channel a1 type disk;
3> allocate auxiliary channel a2 type disk;
4> duplicate target database for standby nofilenamecheck;
5> }
using target database control file instead of recovery catalog
allocated channel: a1
channel a1: SID=134 device type=DISK
allocated channel: a2
channel a2: SID=10 device type=DISK
Starting Duplicate Db at 15-JUN-12
contents of Memory Script:
restore clone standby controlfile;
executing command: SET NEWNAME
Starting restore at 15-JUN-12
file 5 is excluded from whole database backup <==
channel a1: starting datafile backup set restore
channel a1: specifying datafile(s) to restore from backup set
channel a1: restoring datafile 00002 to C:\APP\XYZ\ORADATA\ORAPRD\ORAPHY\DATAFILE\O1_MF_SYSAUX_DATA_D-ORA11PRD_I-2924940358_TS-SYSAUX_FNO-2_08NDBK6A_.DBF
channel a1: restoring datafile 00004 to C:\APP\XYZ\ORADATA\ORAPRD\ORAPHY\DATAFILE\O1_MF_USERS_DATA_D-ORA11PRD_I-2924940358_TS-USERS_FNO-4_09NDBK6B_.DBF
channel a1: reading from backup piece C:\TEMP\RMAN_ORAPRD_0PNDJJN7_1_1.BKP
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=786026596 file name=C:\APP\XYZ\ORADATA\ORAPHY\ORAPHY\DATAFILE\O1_MF_UNDOTBS1_7XPWYO19_.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=11 STAMP=786026596 file name=C:\APP\XYZ\ORADATA\ORAPHY\ORAPHY\DATAFILE\O1_MF_USERS_7XPWYN8N_.DBF
Finished Duplicate Db at 15-JUN-12
released channel: a1
released channel: a2
RMAN>start the managed recovery
SYS @ oraphy>recover managed standby database disconnect;
Media recovery complete.
SYS @ oraphy>select TS#,file#,STATUS,ENABLED from v$datafile order by status;
TS# FILE# STATUS ENABLED
6 5 OFFLINE DISABLED
1 2 ONLINE READ WRITE
2 3 ONLINE READ WRITE
4 4 ONLINE READ WRITE
0 1 SYSTEM READ WRITE
SYS @ oraphy>select thread#,sequence#,process,status from v$managed_standby;
THREAD# SEQUENCE# PROCESS STATUS
1 24 RFS IDLE
1 22 MRP0 WAIT_FOR_GAP <---------------
....archive the current log on the primary database
SYS @ oraprd>select thread#,sequence#,status from v$log;
THREAD# SEQUENCE# STATUS
1 22 INACTIVE
1 23 ACTIVE
1 24 CURRENT
SYS @ oraprd>alter system archive log current;
System altered.
SYS @ oraphy>select thread#,sequence#,process,status from v$managed_standby;
THREAD# SEQUENCE# PROCESS STATUS
1 25 RFS IDLE
1 25 MRP0 WAIT_FOR_LOG <-------- the recovery is in progress on the standby database.
....Regards,
Vaibhav -
Drop a datafile from physical standby's control file
Hi,
I am trying to create a physical standby database for my production...
1) I have taken cold backup of my primary database on 18-Nov-2013...
2) I added a datafile on 19-nov-2013 ( 'O:\ORADATA\SFMS\SFMS_DATA4.DBF' )
3) Standby control file was generated on 20-ov-2013 (today) after shutting down and then mounting the primary database...
When i try to recover the newly setup standby using archive files, i am getting the following error (datafile added on 19th Nov is missing)
SQL> recover standby database;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 39: 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ORA-01157: cannot identify/lock data file 39 - see DBWR trace file
ORA-01110: data file 39: 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
How to overcome this situation...
Can i delete the entry for the newly added datafile from the backup control file ?
When i tried to delete datafile using "alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF';", it is showing that database should be open..
SQL> alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ERROR at line 1:
ORA-01109: database not open
SQL> show parameter STANDBY_FILE_MANAGEMENT
NAME TYPE VALUE
standby_file_management string AUTO
SQL> alter system set STANDBY_FILE_MANAGEMENT=manual;
System altered.
SQL> show parameter STANDBY_FILE_MANAGEMENT
NAME TYPE VALUE
standby_file_management string MANUAL
SQL> alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ERROR at line 1:
ORA-01109: database not open
Regards,
JibuJibu wrote:
Hi,
I am trying to create a physical standby database for my production...
1) I have taken cold backup of my primary database on 18-Nov-2013...
2) I added a datafile on 19-nov-2013 ( 'O:\ORADATA\SFMS\SFMS_DATA4.DBF' )
3) Standby control file was generated on 20-ov-2013 (today) after shutting down and then mounting the primary database..
Hi,
What is your version?
If you added new datafile or created new tablespace, take backup again for restore new created standby database.
If your standby database running well, DG configuration success, then this datafile will create on standby side, too.
Set STANDBY_FILE_MANAGEMENT=AUTO best practice.
When i try to recover the newly setup standby using archive files, i am getting the following error (datafile added on 19th Nov is missing)
SQL> recover standby database;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 39: 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ORA-01157: cannot identify/lock data file 39 - see DBWR trace file
ORA-01110: data file 39: 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
How to overcome this situation...
Can i delete the entry for the newly added datafile from the backup control file ?
Not need any delete datafile from standby side, you must recreate standby database, or you can take RMAN backup and restore to standby side again.
When i tried to delete datafile using "alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF';", it is showing that database should be open..
SQL> alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ERROR at line 1:
ORA-01109: database not open
SQL> show parameter STANDBY_FILE_MANAGEMENT
NAME TYPE VALUE
standby_file_management string AUTO
SQL> alter system set STANDBY_FILE_MANAGEMENT=manual;
System altered.
SQL> show parameter STANDBY_FILE_MANAGEMENT
NAME TYPE VALUE
standby_file_management string MANUAL
SQL> alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
alter tablespace SFMS_BR_DATA drop datafile 'O:\ORADATA\SFMS\SFMS_DATA4.DBF'
ERROR at line 1:
ORA-01109: database not open
It is not logical, Physical standby must be bit-for-bit same with Primary database.
Regards
Mahir M. Quluzade -
Drop a datafile that is offline and not on the OS
I am running a 2 node rac on ASM . 10gR2 on HP UX.
By mistake 1 datafile has been deleted on the OS , and that datafile is marked as offline in the dba_data_files.
How can I drop the datafile from the database.
since when I query the dba_data_files the datafile 10 ( which was deleted on OS ) , shows its still present and online_status is offline.
The datafile is not required and also there is no backup for the datafile.
ThanksHi,
ALTER DATABASE DATAFILE '<full file spec>' OFFLINE DROP;
example: just give '+dg1/../../..' if it not exists also give the same
Kind Regards,
Rakesh Jayappa -
How to move a specific tablespace datafile from one directory to another
Database: 10.2.0.1
OS : Generic
Problem Description : How to move a specific tablespace datafile from one directory to another considering that the database is on Oracle Dataguard setup
** Oracle is working on this issue, but in parallel is opening the topic to the Community so that Community members can add their perspective, experience or knowledge. This will further enhance all knowledge bases including My Oracle Support and My Oracle Support Communities **
Edited by: ram_orcl on 16-Aug-2010 21:21Dear ram_orcl,
Please follow the procedures here;
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ps.htm#i1034172
8.3.4 Renaming a Datafile in the Primary Database
When you rename one or more datafiles in the primary database, the change is not propagated to the standby database. Therefore, if you want to rename the same datafiles on the standby database, you must manually make the equivalent modifications on the standby database because the modifications are not performed automatically, even if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.
The following steps describe how to rename a datafile in the primary database and manually propagate the changes to the standby database.
1.
To rename the datafile in the primary database, take the tablespace offline:
SQL> ALTER TABLESPACE tbs_4 OFFLINE;
2.
Exit from the SQL prompt and issue an operating system command, such as the following UNIX mv command, to rename the datafile on the primary system:
% mv /disk1/oracle/oradata/payroll/tbs_4.dbf
/disk1/oracle/oradata/payroll/tbs_x.dbf
3.
Rename the datafile in the primary database and bring the tablespace back online:
SQL> ALTER TABLESPACE tbs_4 RENAME DATAFILE 2> '/disk1/oracle/oradata/payroll/tbs_4.dbf'
3> TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
SQL> ALTER TABLESPACE tbs_4 ONLINE;
4.
Connect to the standby database, query the V$ARCHIVED_LOG view to verify all of the archived redo log files are applied, and then stop Redo Apply:
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APP
8 YES
9 YES
10 YES
11 YES
4 rows selected.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
5.
Shut down the standby database:
SQL> SHUTDOWN;
6.
Rename the datafile at the standby site using an operating system command, such as the UNIX mv command:
% mv /disk1/oracle/oradata/payroll/tbs_4.dbf /disk1/oracle/oradata/payroll/tbs_x.dbf
7.
Start and mount the standby database:
SQL> STARTUP MOUNT;
8.
Rename the datafile in the standby control file. Note that the STANDBY_FILE_MANAGEMENT initialization parameter must be set to MANUAL.
SQL> ALTER DATABASE RENAME FILE '/disk1/oracle/oradata/payroll/tbs_4.dbf'
2> TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
9.
On the standby database, restart Redo Apply:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
2> DISCONNECT FROM SESSION;
If you do not rename the corresponding datafile at the standby system, and then try to refresh the standby database control file, the standby database will attempt to use the renamed datafile, but it will not find it. Consequently, you will see error messages similar to the following in the alert log:
ORA-00283: recovery session canceled due to errors
ORA-01157: cannot identify/lock datafile 4 - see DBWR trace file
ORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'Hope That Helps.
Ogan -
Droping a datafile from a tablespace
I want to drop a datafile from a tablespace by using the query
SQL> alter tablespace TS1 drop datafile 'OS path\df1';
This query drops the datafile. But physically the datafile is present in the OS path. how to delete the datafile completely from the disk.Version:-
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
Although it's dropped on database level, I can't delete.If dropped data file from ORACLE, it deletes from OS level too. By any other processes being locked like antivirus and so on?
SQL> select file_name from dba_data_files where tablespace_name='USERS';
FILE_NAME
C:\ORACLE\ORADATA\ORCL\USERS01.DBF
C:\ORACLE\ORADATA\ORCL\USERS02.DBF
SQL> alter tablespace users add datafile 'c:\oracle\oradata\orcl\users03.dbf' size 10m;
Tablespace altered.
SQL> host
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\bn2676>cd c:\Oracle\oradata\orcl
c:\Oracle\oradata\orcl>dir users*
Volume in drive C is System
Volume Serial Number is 1853-3E21
Directory of c:\Oracle\oradata\orcl
02/15/2012 11:25 PM 5,251,072 USERS01.DBF
02/16/2012 09:04 PM 10,493,952 USERS02.DBF
02/16/2012 09:05 PM 10,493,952 USERS03.DBF
3 File(s) 26,238,976 bytes
0 Dir(s) 177,196,707,840 bytes free
c:\Oracle\oradata\orcl>exit
SQL> alter tablespace users drop datafile 'c:\oracle\oradata\orcl\users03.dbf';
Tablespace altered.
SQL> select file_name from dba_data_files where tablespace_name='USERS';
FILE_NAME
C:\ORACLE\ORADATA\ORCL\USERS01.DBF
C:\ORACLE\ORADATA\ORCL\USERS02.DBF
SQL> host
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\bn2676>cd c:\Oracle\oradata\orcl\
c:\Oracle\oradata\orcl>dir user*
Volume in drive C is System
Volume Serial Number is 1853-3E21
Directory of c:\Oracle\oradata\orcl
02/15/2012 11:25 PM 5,251,072 USERS01.DBF
02/16/2012 09:04 PM 10,493,952 USERS02.DBF
2 File(s) 15,745,024 bytes
0 Dir(s) 177,207,398,400 bytes free
c:\Oracle\oradata\orcl> -
Can I Drop a datafile from UNDOTBS
Hi!!!!
I want to drop a datafile from UNDOTBS . can I Drop it.
If yes then how to drop ? what is the effect of it on database?
If anybody knows the the answer then Pls reply..You can do this provided test it before doing it in production
Steps.
1. Create a new Undo tablespace
2. Shutdown the database
3. Change the parameter UNDO_TABLESPACE to the newly created undo tablespace
4. Start the database
5. Do whatever you want with the old undo tablespace.
Maybe you are looking for
-
I'm looking to buy a refurbished 2012/2013 Macbook Pro Retina and then to transfer my Adobe Production Suite (Premiere Pro, Photoshop, After Effects, etc.) and an old Microsoft Office Suite from my 2008 Macbook onto it. Is this going to be possible i
-
Encode Motion JPEG Quicktimes with Snow Leopard 10.6.2
I know this is a common question, but I couldn't find a definitive answer that makes sense with what I'm seeing on my computer. I'm trying to make Motion JPEG A Quicktimes (in Compressor or QuickTime Pro) but that codec is not an option in my menus.
-
Logic to get same text for 2 line items
hi all, i have an issue in my report, i have a final internal table. fileds in the table are bukrs belnr gjahr buzei sgtxt 0010 12345 2008 01 text 0010 12345 2008 02 - now the problem is if the belnr is same thn in the final interna
-
I wish to make a purchase through itunes but have been blocked because I cannot remember the answers to my security questions. How can I make a purchase and is there a way to reset these security questions when I don't know the answer to the original
-
I've had a problem occur now and then - I start a new project and set the timeline to measures, but the cursor doesn't snap to the resolution that I set it to. It looks like it's offset so it snaps to the area between measures even when I have the re