PeopleSoft
Home > Ask the Oracle Experts > 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 Peasland EXPERT RESPONSE FROM: Brian Peasland

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.

>
EXPERT RESPONSE
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
Database Backup and Recovery
Analyzing wait events in Oracle
Can I export an Oracle database from UNIX and import to Windows?
Errors when importing from production to development
Oracle upgrade basics
Import on one table from dump file
Why am I getting the ORA-01195 error when issuing a recover command?
Error during RMAN backup
How to encrypt RMAN backups
Redo log file problems
Manual upgrade vs. export and import

Oracle database backup and recovery
Weighing remote database administration pros and cons takes care
Data retention policy for Oracle DBAs: When to "trash" your data
Case study: Oracle RMAN improves backup and recovery efficiency in a multi-platform, multi-application environment
How do I do that in Oracle?
Oracle and the rise of the virtual machine
Oracle 11g data compression
Oracle OpenWorld 2007 Special Report
Hierarchical storage management for database growth, part 1
One datafile not accessible
How to back up archive log files in RAC
Oracle database backup and recovery Research

Oracle database availability
Firm dumps MySQL on Red Hat for Oracle Database on Oracle Linux
Data modeling tools no substitute for hard work
Case study: Oracle RMAN improves backup and recovery efficiency in a multi-platform, multi-application environment
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
Author Mike Ault sizes up the new Oracle Database 11g
Oracle UDP protocol or Veritas LLT for interconnect traffic?
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

HomeNewsTopicsTipsAsk the ExpertsWebcastsWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




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