Home > Ask the Oracle Database / Applications Experts > Oracle database backup and recovery Questions & Answers > Moving Oracle folder to external hard drive
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Moving Oracle folder to external hard drive

Brian Peasland1 EXPERT RESPONSE FROM: Brian Peasland1

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 31 July 2006
I have PeopleSoft installed locally on my laptop and it uses Oracle 9i as its database (also local on the C drive). I understand that all data is under c:\oracle\oradata\FSDMO but I want to be able to move this data (or folder) to my external hard drive (H) to free up space. I'm very sure that a simple cut and paste will not work since there must be some pointer files somewhere that point to this C:\...\FSDMO location. To further clarify, if I navigate to C:\oracle, I find three folders: admin, ora92 and oradata. I just want to move this oradata folder to my external hard drive and leave everything else. How can I accomplish this? Thanks in advance.

>
The "pointers" you are referring to are the database's control files. When an Oracle database is started, it first reads the database's parameter file. In Windows, the service used to start the database has the information for the location of this parameter file. The parameter file contains a parameter called CONTROL_FILES which points to all of the database's control files. The control files contain "pointers" to all of the online redo logs and the database datafiles. You cannot simply move the files and expect everything to work. You have to let Oracle know where everything is moved to. Follow this step-by-step guide to move your control files, online redo logs and database datafiles.

Gather information:

  1. Query the Data Dictionary to determine the current locations of your control files:
         SELECT name FROM v$controlfile;
    
  2. Query the Data Dictionary to determine the current locations of your data files:
         SELECT name FROM v$datafile;
    
  3. Query the Data Dictionary to determine the current locations of your online redo logs:
        SELECT member FROM v$logfile;
    
  4. Keep the information from above as it will be important in later steps.

Move the files:

  1. Modify the parameter file with the new location of your control files.
    • If you are using the old style PFILE, simply modify the CONTROL_FILES parameter with a text editor.
    • If you are using the new sytle SPFILE, modify the CONTROL_FILES parameter with this command:
            ALTER SYSTEM SET control_files=
            ('/new_dir/control01.ctl','/new_dir/control02.ctl',....) 
            SCOPE=spfile; 
      
  2. Perform a clean shutdown of the database (SHUTDOWN NORMAL or SHUTDOWN IMMEDIATE).
  3. Copy the control files, online redo logs and data files with OS commands. In Unix/Linux, we typically use the 'cp' command. In Windows, you can use the 'copy' command or Windows Explorer.
  4. Start up the database in MOUNT mode:
        STARTUP MOUNT
    
  5. Tell the control files of the new online redo log file locations:
        ALTER DATABASE RENAME FILE '/old_dir/redo01a.log' 
        TO '/new_dir/redo01a.log';
    
  6. Repeat the previous step for each and every online redo log that is moved.
  7. Tell the control files of the new data file locations:
        ALTER DATABASE RENAME FILE
        '/old_dir/file01.dbf' TO '/new_dir/file01.dbf';
    
  8. Repeat the previous step for each and every data file that is moved.

Finish up:

  1. Open the database.
         ALTER DATABASE OPEN;
    
  2. Shut down the database and take a backup after all of your hard work.

Step 1 under "Move the files" above changes the pointer of the control file locations so that the control files can be found in step 3. The remaining steps change the pointers in the control files to the new online redo log and datafile locations. Once all of the pointers have been changed, the database can be opened. I cannot stress strongly enough that a backup should be taken at this point. It will be very, very difficult to recover through this operation.

One other note -- sometimes, a DBA wants to change the file's name but not necessarily the location. In Oracle's world, the file's name is the combination of the directory path and the actual file name. So '/dir1/file1.dbf' and '/dir2/file1.dbf' are two distinctly different files. So the process to change the file's name is similar to the above. The ALTER DATABASE RENAME file is used to change the location and the name.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Oracle database backup and recovery
How to perform Oracle database recovery with a corrupt online redo log
Can I create an Oracle Catalog Database with the Enterprise Console?
Do I need to recreate views after an Oracle table reorg?
Client-based apps vs. web-based apps in Developer 2000
How to perform an Oracle 8i to 10g migration
Can I move the tablespace online with missing datafiles in Oracle?
Oracle upgrade process vs. Oracle exp/imp for 9i to 10g migration
How to use RMAN CONVERT to migrate from Solaris to Oracle 11g RHEL
Why am I having trouble installing Oracle 10g on Vista?
Can I load Oracle 8 on Windows Server 2003?

Oracle database backup and recovery
How to perform Oracle database recovery with a corrupt online redo log
Can I create an Oracle Catalog Database with the Enterprise Console?
Do I need to recreate views after an Oracle table reorg?
Client-based apps vs. web-based apps in Developer 2000
Can I move the tablespace online with missing datafiles in Oracle?
How to perform an Oracle 8i to 10g migration
Oracle upgrade process vs. Oracle exp/imp for 9i to 10g migration
How to use RMAN CONVERT to migrate from Solaris to Oracle 11g RHEL
Why am I having trouble installing Oracle 10g on Vista?
Can I load Oracle 8 on Windows Server 2003?
Oracle database backup and recovery Research

Oracle database availability
Review: Oracle's 11g R2 database has some good and bad
Oracle releases new database, says 11g upgrade will cut costs
Firm dumps MySQL on Red Hat for Oracle Database on Oracle Linux
Data modeling tools no substitute for hard work
Oracle RMAN case study: Improving backup and recovery efficiency
Oracle and the rise of the virtual machine
Using connection load balancing with Oracle RAC
Grid computing adoption slow amid fears of complexity
DBA 102: Beyond the basics
Difference between Oracle RAC and Data Guard
Oracle database availability Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts