Alter Database Remove File : Partition Files on different folders

I need to remove partition files, once I switch the partition with staging table and empty/truncate the partition. 
When I was running the code on my local machine I was passing variable @partition_file_name to following statement:
Declare @partition_file_name varchar(128)='table_abc_201202',
@database_name varchar(128)='test'
Alter Database @database_name Remove File  @partition_file_name
Note @partition_file_name is the logical name of the partition file.
I found out partitions are saved in different folders in my Dev env...They are stored in 12 different folders which are named like 1-12.
E.g:
C:\DATA\2\table_abc_201202.ndf
C:\DATA\3\table_abc_201203.ndf
C:\DATA\4\table_abc_201204.ndf
C:\DATA\5\table_abc_201205.ndf
C:\DATA\2\table_abc_201302.ndf
C:\DATA\3\table_abc_201303.ndf
C:\DATA\4\table_abc_201304.ndf
C:\DATA\5\table_abc_201305.ndf
I am wondering , is SQL server with Alter statement is capable of getting the right path for each partition files and remove them accordingly? Or do I need to pass the physical path to the alter statement to get it removed. Though I tried doing that and
got the error.
ZK

I am wondering , is SQL server with Alter statement is capable of getting the right path for each partition files and remove them accordingly? Or do I need to pass the physical path to the alter statement to get it removed. Though I tried doing that and
got the error.
Yes, SQL Server knows which physical file goes with which logical filename.  (To see that SQL does know this, do a SELECT * FROM sys.sysfiles - you'll see SQL has a row for every logical filename and that row has the corresponding physical file name.)
And when you do the ALTER DATABASE REMOVE FILE, you must specify the logical filename.  You will get an error if you give the physical path.
Tom

Similar Messages

  • Music files stored in two different folders

    Most of my music files are located in the folder I named for my iTunes library. Others are in a Music folder which is a subfolder of the iTunes Media folder. I'm not sure how this happened, but it seems to have happened after a backup. All the new additions went to the iTunes Media subfolder. I'd like them to be all in one place. How can I achieve that? I'm running iTunes 10.7.

    Open iTunes and choose to organize or consolidate the library.
    (111116)

  • UNABLE TO USE  COMPILED CLASSES STORED IN DIFFERENT FOLDERS

    Can you help me out
    i have a problem i have been creating various modules and the compiled classes files are stored in different folders and i want the module to access the compiles classes file from the respective folders can any one give me some idea how to get it working.
    thankyou

    You need to make the folders into packages. Say you have 2 folders, one with your core classes named "core", and one with your GUI classes named "gui". These folders are in a folder called "myprogram". You then put a statement at the top of each file in the "core" folder like this: package myprogram.core; Do the same with all the java files in the "gui" folder as well, but replace .core with .gui. Then, you import your own package the same way you do normal java packages: import myprogram.core.*;
    I hope that makes sense, for more info here is the Java tutorial: http://java.sun.com/docs/books/tutorial/java/interpack/packages.html

  • REG: 4 different folders from the source side and we need to have the BPM t

    Hi All,
    We are using a BPM for file-idoc scenario. Previously we use to have one source folder which sends file and the bpm worked fine. Now we have a requirement where the files come from 4 different folders from the source side and we need to have the BPM to run independently for each folder.
    What are the changes to be made in IR and id for this..
    Thanks & Regards,
    Kiran.

    File adapter has a option advance selection of source file setting which can be used for picking files from different folder.

  • ALTER DATABASE/MODIFY FILE issue

    Greetings to all --
    We are running SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64), and running into what seems like a bug. One of the largest tables was moved to a separate file group a while ago, and now a large percentage of the rows from that table (about 50GB) , need to
    be removed.
    We wanted to reduce the amount of transaction log growth and the duration required for the delete. Recovery model was set to BULK_LOGGED before executing the following steps:
    1. create a new filegroup
    2. create a new file in that filegroup
    3. set the new filegroup to be the DEFAULT filegroup
    4. SELECT INTO new_table from original_table WHERE filter_condition
    5. drop original_table
    6. rename new_table to original_table
    7. remove original file from original filegroup
    8. remove original filegroup
    9. MODIFY the logical name of the new file to be the same as the logical name of the original logical name.
    ALTER DATABASE myDB
    MODIFY FILE ( NAME = new_logicalname, NEWNAME = original_logicalname)
    This fails:
    Msg 1828, Level 16, State 3, Line 1
    The logical file name "original_logicalname" is already in use. Choose a different name.
    I noticed that the original filegroup still persisted until I did a transaction log backup, but after that , there is no entry for that file in sys.databasefiles for that database.
    Checking sp_helpdb for that database shows only the new logical file name.
    Any thoughts would be much appreciated.

    This scenario is easily reproduced, and seems not to be "by design".
    I put my bets on Sean and say "by design".
    I can't put my finger on it, but it has to with doing restores, and particularly log restores. It does not seem to happen with a database in simple recovery. But for a database in full (or bulk_logged) recovery, there lingers a row in sysfiles1 and sysprufiles
    for the dropped file.
    sys.database_files is a view over sys.sysprufiles and it does not display the deleted file, but it is there with a certain status.
    In any case, I can't see that this is the end of the world. It is not likely that you refer to the name of that fill all around the house. But the next time you do this manouvre, you may want to rename the existing file before you drop it and create
    the new one.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Cannot remove 2nd log file on AlwaysOn database

    Hi all,
    I have a database, member of an availability group. This database has 2 log file, I want to remove the unsed secondary log file, I try to run this command to empty the second lofg file:
    USE [TEST-AG]
    GO
    DBCC SHRINKFILE (N'TEST-AG_log_2' , EMPTYFILE)
    GO
    the command completes successfully, the I run the command to remove the file:
    USE [TEST-AG]
    GO
    ALTER DATABASE [TEST-AG]  REMOVE FILE [TEST-AG_log_2]
    GO
    But this command fails with the following message:
    Error 5042: The
    file 'TEST-AG_log_2' cannot
    be removed because it is not empty.
    If I remove the database from availability group the command to remove the 2nd file works, so I can't remove a secondary log file on a database member
    of an alwayson availability grup?

    Hi all,
    I have a database, member of an availability group. This database has 2 log file, I want to remove the unsed secondary log file, I try to run this command to empty the second lofg file:
    USE [TEST-AG]
    GO
    DBCC SHRINKFILE (N'TEST-AG_log_2' , EMPTYFILE)
    GO
    the command completes successfully, the I run the command to remove the file:
    USE [TEST-AG]
    GO
    ALTER DATABASE [TEST-AG]  REMOVE FILE [TEST-AG_log_2]
    GO
    But this command fails with the following message:
    Error 5042: The file 'TEST-AG_log_2' cannot
    be removed because it is not empty.
    If I remove the database from availability group the command to remove the 2nd file works, so I can't remove a secondary log file on a database member of an alwayson
    availability grup?
    Remove the database from availability group, then remove 2nd file.  You have been successfully. Then add back database to the availability group, then create regular backup jobs of the database.

  • During daily refresh/clone alter database rename file genrating logs under $ORACLE_HOME/dbs with name c-1437102747-20130920-16

    Did anyone have seen this behavior?
      DB version : 11.1.0.7
      OS : HP-UX Itanum
      EBS -11.5.10.2
    We are doing daily refresh/clone of a database instance from production. Recently we are seeing the growth of $ORACLE_HOME/dbs directory during this
    refresh.   During investigation we find out that
      1) When we rename the database files after database restoration. Each below command genrating the 24MB of log file under $ORACLE_HOME/dbs.
      Command :
      alter database rename file '/db02/prod/XDB.dbf' to '/db02/test/XDB.dbf';
    alter database rename file '/db02/prod/a_archive01.dbf' to '/db02/test/a_archive01.dbf';
      Logfiles under $ORACLE_HOME/dbs on target :
      -rw-r----- xxxxx 24379392 Sep 20 05:30 ./dbs/c-1437102747-20130920-02
      -rw-r----- xxxxx 24379392 Sep 20 05:30 ./dbs/c-1437102747-20130920-03
      2) After few minutes, these logs got removed from the directory.
      3) Did not find anything unusual in the alert log.

    These are controlfile autobackups.   Every time you make a physical change to the database structure, an autobackup is created.  In 11.2, the frequency is reduced -- for example if you make 5 changes in quick succession, one autobackup is created.
    CONTROLFILE AUTOBACKUP ON    would be visible when you do a SHOW ALL in rman.
    Hemant K Chitale

  • Diff btw "recover datafile file#" & "alter database recover datafile file#"

    What is the difference between
    "recover datafile file#"
    "alter database recover datafile file#"
    Thanks
    Naveen

    I don't mean to be rude, but the statement that "There is no difference in both the commands" is facile in the extreme. Sounds like more off-the-cuff instant advice than the considered thoughts of someone who's actually bothered to try both commands out.
    The "alter database recover..." command is a disaster waiting to happen and should never be used by anyone who actually wants to achieve a successful database recovery. It has the effect of suppressing most of the interactive dialogue you get when you submit the shorter "recover..." command, and indeed causes spurious errors to be displayed because the non-interactive recovery process gets it wrong.
    For example, here's me recovering my database using the "alter database" syntax:
    SQL> alter database open;
    alter database open
    ERROR at line 1:
    ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
    ORA-01110: data file 4: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\WIN10\USERS01.DBF'
    SQL> alter database recover datafile 4;
    alter database recover datafile 4
    ERROR at line 1:
    ORA-00279: change 642359 generated at 07/04/2008 09:03:18 needed for thread 1
    ORA-00289: suggestion :
    C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_9_%U_.ARC
    ORA-00280: change 642359 for thread 1 is in sequence #9Note the slightly alarming report of an 'error at line 1'. What's difficult to convey in mere text, however, is that at the end of that output, the thing just sits there, and you've no idea what on Earth is happening on the database. The text tells you it's making a suggestion, but there's no indication of how you accept the suggestion, of what's happening when you do accept it or where anything is up to.
    I've interrupted one of those once (fortunately only in a training room) and lost the entire database as a result (because a half-complete, interrupted recovery is worse than no recovery at all).
    Compare that with the plain "recover..." syntax example:
    SQL> recover datafile 4;
    ORA-00279: change 642359 generated at 07/04/2008 09:03:18 needed for thread 1
    ORA-00289: suggestion :
    C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_9_%U_.ARC
    ORA-00280: change 642359 for thread 1 is in sequence #9
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    ORA-00279: change 642571 generated at 07/04/2008 09:06:26 needed for thread 1
    ORA-00289: suggestion :
    C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_10_%U_.ARC
    ORA-00280: change 642571 for thread 1 is in sequence #10
    ORA-00278: log file
    'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_9_46TPVL2G_.ARC' no longer needed for this recovery
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    ORA-00279: change 642576 generated at 07/04/2008 09:06:32 needed for thread 1
    ORA-00289: suggestion :
    C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_12_%U_.ARC
    ORA-00280: change 642576 for thread 1 is in sequence #12
    ORA-00278: log file
    'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_11_46TPVRMK_.ARC' no longer needed for this recovery
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    Log applied.
    Media recovery complete.There are no weird error messages reported here. The suggestion is accompanied by a prompt that tells you how to accept it. Every time a new log is required, a new prompt is given. You can cleanly cancel at any time by typing 'cancel'. You are kept informed throughout and are in charge throughout.
    Anyone that uses "alter database" syntax during a recovery is, therefore, either brave or foolhardy. In either case, there is a very profound difference between the two.
    Your parting shot that 'alter database' is a SQL command and 'recover' can be an RMAN command misses the point by a wide mile, too. RMAN can issue pretty much any piece of SQL you like, so long as you wrap it in the SQL command:
    RMAN> sql 'alter database recover datafile 4';
    using target database control file instead of recovery catalog
    sql statement: alter database recover datafile 4
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of sql command on default channel at 07/04/2008 09:23:16
    ORA-00279: change  generated at  needed for thread
    RMAN-11003: failure during parse/execution of SQL statement: alter database recover datafile 4
    ORA-00279: change 642359 generated at 07/04/2008 09:03:18 needed for thread 1
    ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\WIN10\ARCHIVELOG\2008_07_04\O1_MF_1_9_%U_.ARC
    ORA-00280: change 642359 for thread 1 is in sequence #9We don't get much further in RMAN with this dodgy form of the recovery command than we did in SQL*Plus, it's true -but that's just because it's a silly command to use in the first place, wherever you thought to use it. The distinction you seek to draw between 'SQL commands' and 'RMAN commands' is false in this case, in other words.

  • Database name ORCL in file header does not match given name of

    Hi all,
    DB version is 10.2.0.4
    While doing db cloning..restoring the database..made a mistake of restoring the db to a different running mountpoint database..But in 20 minutes realised that after a while and restarted the clone.
    But that running db went down..trying to recover it shows
    ERROR at line 1:
    ORA-01161: database name ORCL in file header does not match given name of
    PRODhow can i recover it?
    thanks,
    baskar.l

    baskar.l wrote:
    Hi all,
    DB version is 10.2.0.4
    While doing db cloning..restoring the database..made a mistake of restoring the db to a different running mountpoint database..But in 20 minutes realised that after a while and restarted the clone.
    But that running db went down..trying to recover it shows
    ERROR at line 1:
    ORA-01161: database name ORCL in file header does not match given name of
    PRODhow can i recover it?
    thanks,
    baskar.lHi,Baskar.How you clone your database and which command after you got this error.You can resolve this problem with re-create controlfile as(It mean is you actually change your database name):
    C:\Documents and Settings\Administrator>sqlplus "sys/sm as sysdba"
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 20 15:34:21 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> startup nomount pfile=D:\oracle\product\10.2.0\admin\SB\pfile\init.ora.5152
    010163530
    ORACLE instance started.
    Total System Global Area  138412032 bytes
    Fixed Size                  1247732 bytes
    Variable Size              62916108 bytes
    Database Buffers           71303168 bytes
    Redo Buffers                2945024 bytes
    SQL> CREATE CONTROLFILE reuse DATABASE "SB1" RESETLOGS  ARCHIVELOG
      2      MAXLOGFILES 16
      3      MAXLOGMEMBERS 3
      4      MAXDATAFILES 100
      5      MAXINSTANCES 8
      6      MAXLOGHISTORY 292
      7  LOGFILE
      8    GROUP 1 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO01.LOG'  SIZE 50M,
      9    GROUP 2 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO02.LOG'  SIZE 50M,
    10    GROUP 3 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO03.LOG'  SIZE 50M
    11  DATAFILE
    12    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSTEM01.DBF',
    13    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\UNDOTBS01.DBF',
    14    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSAUX01.DBF',
    15    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\USERS01.DBF',
    16    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\EXAMPLE01.DBF';
    CREATE CONTROLFILE reuse DATABASE "SB1" NORESETLOGS  ARCHIVELOG
    ERROR at line 1:
    ORA-01503: CREATE CONTROLFILE failed
    ORA-01161: database name SB in file header does not match given name of SB1
    ORA-01110: data file 1: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSTEM01.DBF'
    SQL> CREATE CONTROLFILE set DATABASE "SB1" RESETLOGS  ARCHIVELOG
      2      MAXLOGFILES 16
      3      MAXLOGMEMBERS 3
      4      MAXDATAFILES 100
      5      MAXINSTANCES 8
      6      MAXLOGHISTORY 292
      7  LOGFILE
      8    GROUP 1 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO01.LOG'  SIZE 50M,
      9    GROUP 2 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO02.LOG'  SIZE 50M,
    10    GROUP 3 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO03.LOG'  SIZE 50M
    11  DATAFILE
    12    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSTEM01.DBF',
    13    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\UNDOTBS01.DBF',
    14    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSAUX01.DBF',
    15    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\USERS01.DBF',
    16    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\EXAMPLE01.DBF';
    CREATE CONTROLFILE set DATABASE "SB1" RESETLOGS  ARCHIVELOG
    ERROR at line 1:
    ORA-01503: CREATE CONTROLFILE failed
    ORA-00200: control file could not be created
    ORA-00202: control file: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\CONTROL01.CTL'
    ORA-27038: created file already exists
    OSD-04010: <create> option specified, file already exists
    /*remove all controlfile  from D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\ */
    SQL> CREATE CONTROLFILE set DATABASE "SB1" RESETLOGS  ARCHIVELOG
      2      MAXLOGFILES 16
      3      MAXLOGMEMBERS 3
      4      MAXDATAFILES 100
      5      MAXINSTANCES 8
      6      MAXLOGHISTORY 292
      7  LOGFILE
      8    GROUP 1 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO01.LOG'  SIZE 50M,
      9    GROUP 2 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO02.LOG'  SIZE 50M,
    10    GROUP 3 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\REDO03.LOG'  SIZE 50M
    11  DATAFILE
    12    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSTEM01.DBF',
    13    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\UNDOTBS01.DBF',
    14    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\SYSAUX01.DBF',
    15    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\USERS01.DBF',
    16    'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SB\EXAMPLE01.DBF';
    Control file created.
    SQL> recover database using backup controlfile until cancel;
    ORA-00279: change 742571 generated at 06/20/2010 15:32:41 needed for thread 1
    ORA-00289: suggestion :
    D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\SB1\ARCHIVELOG\2010_06_20\O1_MF_1_1
    1_%U_.ARC
    ORA-00280: change 742571 for thread 1 is in sequence #11
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    D:\oracle\product\10.2.0\oradata\SB\REDO01.LOG
    Log applied.
    Media recovery complete.
    SQL> alter database open resetlogs;
    Database altered.
    SQL> create spfile from pfile;
    File created.
    SQL>In additionally see metalink note
    ORA-01503 ORA-01161 While creating a clone database. [ID 294555.1]
    Edited by: Chinar on Jun 20, 2010 3:52 AM

  • Database creation using backups files

    Hi,
    I would like to create a test database from backup of my production database.
    I am new to this task.
    Please correct me if I am wrong.
    in production server
    1.Login as sysdba in the and issue
    "alter database backup controlfile to trace" command
    in test server
    2.Create a user oratest
    2.Copy all the data files from production server
    3.Copy the Oracle home
    4.Edit the trace file
    i.CREATE CONTROLFILE SET DATABASE "prod" RESETLOGS
    in place of
    CREATE CONTROLFILE REUSE DATABASE "test" NORESETLOGS
    ii.Remove the recover database and alter database open lines.
    iii.Edit the data files with new path in test server.
    iv.save as db_create.sql
    5.create the new database by executing
    i.sqlplus '/as sysdba'
    ii.startup nomount
    iii.@db_create.sql
    iv.alter database open.
    What changes I have to do after copying initprod.ora to inittest.ora?
    Thanks,

    Your question is lacking the 4-digit version of the database, and the O/S.
    For Oracle 10g and higher, using database control, it would be much more easy to duplicate the database to another server, using rman.
    The procedure you describe is incomplete and incorrect and will fail for several reasons.
    2.Create a user oratest -- why?
    2.Copy all the data files from production server -- obviously the production database needs to be shutdown for this, or all files will be inconsistent
    3.Copy the Oracle home -- if you created a new user oratest, and the user on the production server is oracle, this is not going to work, as the user and group info is linked into the Oracle executable. Also the O/S and version must be identical.
    If you created a new user, you need to reinstall Oracle, if your O/S version is not identical you need to relink Oracle.
    4 i is incorrect
    Obviously, in inittest.ora all occurrences of prod need to replaced by test.
    But then again: use RMAN and the only command you need is duplicate database, and the production database can stay online.
    Sybrand Bakker
    Senior Oracle DBA

  • How to Create new database from cold backup files.

    Dear Experts,
    I have an oracle 10g databae on windows 2003 server.
    The database is in Archive log mode and backup strategy is Taking cold backup ever night.
    Backup steps:
    shut down database.
    copy data files, control files, redo logs, archive logs and parameter files to safe location.
    Startup.
    I have taken a backup at Tuesdaay 1AM and I have archive logs also.
    On Wednesday, I want to Create a new database on another server with the available cold backup files and archive logs. I want to recover the database upto 4PM Wednesday. How can I do this.
    I am not using control file auto backup or control file backup to trace.
    Please help me how can I do this. I am new to oracle database Administration.
    --Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The steps :
    shut down database.
    copy data files, control files, redo logs, archive logs and parameter files to safe location -- you mean the alternate location for the new databaseare correct (except that I would say "alternate location for the new database").
    If you do not have controlfile backups, you cannot either OPEN the database or RECOVER the database until and unless you CREATE the Controlfiles. You have to generate a CREATE CONTROLFILE script using a BACKUP CONTROLFILE TO TRACE from the Production serer and create the controlfile on the new server.
    BEFORE the Startup, I would use
    RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;The "using backup controlfile" tells Oracle to continue attempting Recovery -- ie doing a RollForward -- till the last archivelog made available to it.
    For the Recover command, you then keep applying the ArchiveLogs from the Tuesday 1am ColdBackup upto Wednesday 4pm.
    Once you have applied the last ArchiveLog, you do an
    ALTER DATABASE OPEN RESETLOGS;Here are my notes of doing a RollForward "Recovery" from a Cold Backup :
    http://hemantoracledba.blogspot.com/2007/05/rollforward-from-cold-backup.html
    If you are attempting all these steps on a different server from your current Production database, you should be safe.
    Once you OPEN the database, you can use CREATE CONTROLFILE or the NID utility to rename the database.
    If you are attempting to create the new database on the same server there are many other precautions you have to take and unless you have experience with cloning databases, I would advice you against doing so (only the RMAN DUPLICATE DATABASE command has a safer method of cloning a database).
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Is there a way to remove the .lock file programmatically?

    I'm creating a web app with NetBeans, Tomcat and the H2 Database Engine and am having troubles with database errors that seem to be caused by the .lock file existing in the directory where I am storing the database.
    Is there a way to programmatically remove the .lock file? I like for the database to be locked only when it is being accessed by either of two different servers, but so far am having trouble with only one server running.
    I have tried calling the close() method from the class that calls my database class when it is done with it, but it is creating an exception stating that the database is already open and tells me to close it. That's what I was trying to do!
    Edited by: GoDonkeys on Feb 9, 2010 4:39 PM

    Saish wrote:
    Are you closing it this way [http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_closing-sect]? And why are you worried about this? If two servers are going to connect, you should be running in HSQL "server" mode [http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_modes-sect]. You can erase the lock file using java.io.File. But IMO, the fact you want to do this indicates you are not using the right database mode.
    - SaishI started out using HSQLDB, but it was giving me problems when I was trying to add data to my database, so I switched to H2 (as stated above) and it was able to add as much data as I could throw at it without any issues. My problem is that while debugging with NetBeans I occasionally get exceptions from H2 (through JDBC) that the database is locked and access was denied.
    I would like to be able to only have the database "open" when I'm actively querying it or manipulating it.

  • Removing arch1*.dbf files to save disk space

    Hello folks,
    arch1*.dbf files are archive redo log files? They are filling up my harddisk. Are they safe to remove? How can I stop archiving?

    In the pfile, as I have said in my earlier post, these lines are commented out:
    # Uncommenting the lines below will cause automatic archiving if archiving has
    # been enabled using ALTER DATABASE ARCHIVELOG.
    # log_archive_start = true
    # log_archive_dest_1 = "location=/opt/app/oracle/admin/cdr/arch"
    # log_archive_format = arch_%t_%s.arc
    That's why I cannot understand what's happening. However in the alert file I am having these logs:
    cdr; ARC1: Creating local archive destination LOG_ARCHIVE_DEST_1: '/opt/app/oracle/product/10.1.0/dbs/arch1_62443_509796482.dbf' (th
    read 1 sequence 62443)
    ARCH: Connecting to console port...
    Thu May 6 09:35:33 2004
    cdr; ARC1: Closing local archive destination LOG_ARCHIVE_DEST_1: '/opt/app/oracle/product/10.1.0/dbs/arch1_62443_509796482.dbf'
    ARCH: Connecting to console port...
    Committing creation of archivelog '/opt/app/oracle/product/10.1.0/dbs/arch1_62443_509796482.dbf'
    etc..
    Of course when I had no disk space I was having these errors:
    ARCH: Connecting to console port...
    Mon May 17 09:07:07 2004
    Errors in file /opt/app/oracle/admin/cdr/bdump/cdr_arc0_582.trc:
    ORA-19502: write error on file "/opt/app/oracle/product/10.1.0/dbs/arch1_63596_509796482.dbf", blockno 18433 (blocksize=512)
    ORA-27063: number of bytes read/written is incorrect
    SVR4 Error: 28: No space left on device

  • Problem in creating database -Missing Redo log file

    I am try to create a new database using DBCA .While creating a database it shows the error oracle instance terminated.Force Disconnected.
    My alert log file is
    Errors in file /u01/app/oracle/diag/rdbms/oracl/oracl/trace/oracl_ora_5424.trc:
    ORA-00313: open failed for members of log group 1 of thread 1
    ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/oracl/redo01.log'
    ORA-27037: unable to obtain file status
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3
    Wed Nov 06 10:07:27 2013
    Errors in file /u01/app/oracle/diag/rdbms/oracl/oracl/trace/oracl_ora_5424.trc:
    ORA-00313: open failed for members of log group 2 of thread 1
    ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/oracl/redo02.log'
    ORA-27037: unable to obtain file status
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3
    Errors in file /u01/app/oracle/diag/rdbms/oracl/oracl/trace/oracl_ora_5424.trc:
    ORA-00313: open failed for members of log group 3 of thread 1
    ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/oracl/redo03.log'
    ORA-27037: unable to obtain file status
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3
    Wed Nov 06 10:07:38 2013
    Setting recovery target incarnation to 2
    Wed Nov 06 10:07:38 2013
    Assigning activation ID 1876274518 (0x6fd5ad56)
    Thread 1 opened at log sequence 1
      Current log# 1 seq# 1 mem# 0: /u01/app/oracle/oradata/oracl/redo01.log
    Successful open of redo thread 1
    Wed Nov 06 10:07:38 2013
    MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
    Wed Nov 06 10:07:38 2013
    SMON: enabling cache recovery
    Errors in file /u01/app/oracle/diag/rdbms/oracl/oracl/trace/oracl_ora_5424.trc  (incident=1345):
    ORA-00600: internal error code, arguments: [kpotcgah-7], [12534], [ORA-12534: TNS:operation not supported
    Incident details in: /u01/app/oracle/diag/rdbms/oracl/oracl/incident/incdir_1345/oracl_ora_5424_i1345.trc
    Wed Nov 06 10:07:46 2013
    Trace dumping is performing id=[cdmp_20131106100746]
    Errors in file /u01/app/oracle/diag/rdbms/oracl/oracl/trace/oracl_ora_5424.trc:
    ORA-00600: internal error code, arguments: [kpotcgah-7], [12534], [ORA-12534: TNS:operation not supported
    Error 600 happened during db open, shutting down database
    USER (ospid: 5424): terminating the instance due to error 600
    Instance terminated by USER, pid = 5424
    ORA-1092 signalled during: alter database "oracl" open resetlogs...
    ORA-1092 : opiodr aborting process unknown ospid (5424_47935551851664)
    Wed Nov 06 10:07:47 2013
    ORA-1092 : opitsk aborting process
                                                                                                                                   251,1         95%

    >I am try to create a new database using DBCA
    >Please help me to resolve this issue.My redo log file was missing
    DROP and recreate the database.  It is a *new* database without any data.
    Check what datafile locations and redo log file locations you specify when creating the new database. Check if you have permissions and enough disk space.
    Hemant K Chitale

  • How do I remove a few files from a burn folder?

    I cannot believe I have to ask such a simple question; WHY is everyhting so difficult and complicated with Macs?! I have a DVD in the Mac; I put a number of files into the 'burn folder' which appears automatically. It tells me there are too many files to burn (I have no way of calculating the exact amount to fill the DVD, so have to use trial & error).
    On a Windows PC there would be a little button saying 'remove'; you simply highlight a few folders at a time & click 'remove' - & bingo - they vanish from the folder to be burned. But it seems I have to actually send these 'alias' files to the trash in order to get them out of the burn folder? I saw another discussion on here that suggests this will delete the original files? HOW stupid and badly designed is that?!! I tried sending some to the trash but this takes forever; it does not seem to have deleted the originals, but I would like someone to confirm this please - and please can someone tell me how to delete the contents / some of the contents of a burn folder if I've made a simple mistake in what I've added to it? There HAS to be some way of getting rid of files without deleting the originals - surely?!

    Pardon me for jumping in, but in my experience deleting an alias from a burn folder (or elsewhere) leaves the original intact.  I don't know why deleting the alias files takes so long on your system - on mine, a mid-2011 mini with 8GB RAM running 10.7.5, it happens pretty immediately.  I didn't initially like the Burn Folder concept, but since I've gotten used to it, it's OK - although it seems to add some unnecesary complexity if I want, for example, to move some (but not all) of the files in a folder onto a CD/DVD.
    To delete aliases of files that I don't want burned, I (right-click) (control-click) (two finger tap) on the alias, then select "Move to Trash".  That's not the only way it can be done, of course.
    As baltwo used it, I think "WAG" is supposed to indicate a sort of guess.  A "burning maven" would be a person with extensive knowledge of burning CDs and DVDs on a Mac.  Since none have weighed in, there must be some sort of maven convention going on.
    But, yes, what you've described should work fine.  If you're super concerned about files being deleted when you delete an alias to them and don't have an up-to-date backup, just make a copy of the file (not the alias) in a different folder.
    Good luck
    srb

Maybe you are looking for