Two Simple Methods to Move/Rename Oracle DB Data Files

First Method (must be done as sysdba):

1. First, shut down the database: “shutdown immediate;”
2. Rename and/or move data files to new destination using OS commands (e.g. mv for linux)
3. Startup DB in mount mode: “startup mount;”
4. Change data files names from the DB: “alter database rename file ‘ old_absolute_path_to_old_file_including_filename’ TO ‘new_absolute_path_to_old_file_including_filename’ ;”
5. Open the DB: “alter database open;”

Second Method (must be done as sysdba as well):

1. Take the tablespace offline: “alter tablespace app_data offline;”
2. Rename and/or move data files to new destination using OS commands (e.g. mv for linux)
3. Use the alter tablespace command to rename the file in the database: “alter tablespace tablespace_name rename datafile ‘ old_absolute_path_to_old_file_including_filename’ TO ‘new_absolute_path_to_old_file_including_filename’ ;”
4. Bring the tablespace back online: “alter tablespace tablespace_name online;”

Advantage of the second over the first is that you don’t need to bring the whole DB down, only the tablespace, however I still prefer the first 🙂

Note: To get the names of the existing Data Files, use the following query: “select name from v$datafile;”

Source: Ahmed Ismail

Posted in Uncategorized | Tagged , , , , , | Leave a comment

SQL Statement to get version of your Oracle DB

> sqlplus / as sysdba

SQL> select * from v$version;

BANNER
——————————————————————————–
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
PL/SQL Release 11.2.0.2.0 – Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 – Production
NLSRTL Version 11.2.0.2.0 – Production

Posted in Uncategorized | Tagged , , , | Leave a comment

Alternative way to find files with specific extension in a folder on Linux

If you don’t like the “find” command, you can use the following one instead (I prefer it myself):

ls -R | grep “\.xml”

where “-R” lists all recursively
grep is used to filter filename
“\.xml” you must put the “\” before any special character to return the proper result, you can of course use any other regular expression”

Posted in Linux | Tagged , , , , | Leave a comment

How to mount CD on Linux

mount -t iso9660 -o ro /dev/cdrom /mount_point

Posted in Uncategorized | Tagged , , | Leave a comment

NFS Mount Issue: chown can’t change membership of nfs filesystem shared from OpenFiler

The problem is the following: I created an NFS share from OpenFiler, and when I tried to mount it using the NFS client on other server, it mounted successfully, but I couldn’t change ownership of the NFS share, as follows:

[root@egohstest04 ~]# chown -R siebel:siebel /ttslab2/siebel/siebelfs
chown: changing ownership of `/ttslab2/siebel/siebelfs’: Operation not permitted

The solution to this is to edit the NFS share options, and change the UID/GID Mapping to “no_root_squash”, and there you go 🙂

Enjoy!

Source: http://www.linuxquestions.org/questions/linux-server-73/nfs-and-chown-wtf-552879/

Posted in Linux | Tagged , | Leave a comment