iSelfSchooling.com - Since 1999  References  |  Job Openings
    Home  | Search more  | Oracle Syntax  | Computer Institute   | (Login or Register to access to VIDEOS)
 

Copyright & User Agreement

   Suggestions Email2aFriendHomepage us! |  Bookmark

Services

  Vision/Mission

  Services

  Biography

  Contact Us

 FREE Training

  Start...

  SQL

  PL/SQL

  Forms 

  Reports

  DBA Fundamentals

  Performance

  Prepare for OCP

  ShareUrNotes

...

  Acknowledgement

  Who is who

  University Directory

  Links...

 

 

 

FREE Online Oracle Training for beginners and advanced - The most comprehensive Oracle tutorial

The authors do not guarantee or take any responsibility for the accuracy, or completeness of the information.

BASICS

SQL | PL/SQL

DEVELOPERS

FORMS 2 | REPORTS | Other TOOLS

DBAs

FUNDAMENTALS 2 | PERFORMANCE | OEM

ADVANCE

APPLICATION SERVER | GRID CONTROL | ARTICLES 2 3 4

Advanced - Articles III

Lesson 01 | Lesson 02 | Lesson 03 | Lesson 04 | Lesson 05 | Lesson 06 | Lesson 07 | Lesson 08 | Lesson 09 | Lesson 10 | Lesson 11 | Lesson 12 | Lesson 13 | Lesson 14 | Lesson 15 | Lesson 16 | Lesson 17 | Lesson 18 | Lesson 19 | Lesson 20 | Lesson 21 | Lesson 22 | Lesson 23 | Lesson 24 | Lesson 25 | Lesson 26 | Lesson 27 | Lesson 28 | Lesson 29 | Lesson 30 | Lesson 31 | Lesson 32 | Lesson 33 | Lesson 34 | Lesson 35 |

Lesson 10

"What befalls the earth befalls all the sons of the earth. This we know: the earth does not belong to man, man belongs to the earth. All things are connected like the blood that unites us all. Man does not weave this web of life. He is merely a strand of it. Whatever he does to the web, he does to himself."

-Chief Seattle (1786-1866)

How to change or rename a database name
 
The following are steps to rename a database name:
1. Login to sqlplus and backup the controlfile to trace.
$ sqlplus /nolog
$ SQL> connect / as sysdba
$ SQL> alter database backup controlfile to trace;
 
2. Shutdown your databse.
$ SQL> connect / as sysdba
$ SQL> shutdown immediate;
 
3. Copy the content of your backup controlfile to a file and
call it "rename-my-database.sql" or rename it.
 
4. Rename all your controlfiles.
$ mv /u02/oradata/mydb/control_01 .ctl /u02/oradata/mydb/control_01 .ctl.old
$ mv /u03/oradata/mydb/control_02 .ctl /u03/oradata/mydb/control_02 .ctl.old
Rename all your controlfiles you have. To find their location, do the following:
$ SQL> connect / as sysdba
$ SQL> select name from v$controlfile;
NAME
------------------------------ ------------------------------ --------------------
/u06/oradata/mydb/control01.ctl
/u02/oradata/mydb/control02.ctl
/u03/oradata/mydb/control03.ctl
 
5. Change the folloing parameter in your CREATE CONTROLFILE statement.
you may have something like this:
CREATE CONTROLFILE REUSE DATABASE "mydb" NORESETLOGS ARCHIVELOG
changs:
CREATE CONTROLFILE SET DATABASE "mynewdb" RESETLOGS ARCHIVELOG
 
6. Make sure your init file points to your new database and instance.
*.db_name='mynewdb'
*.instance_name='mynewdb'
 
7. Connect to sqlplus as sysdba and then run the "rename-my-database.sql" script.
$ SQL> connect / as sysdba
$ SQL> startup nomount pfile= init.ora
$ SQL> @rename-my-database.sql
 

How to clone a database from my server to another to a different server
 
The following are steps to clone a database from one server to another:
1. Login to sqlplus and backup the controlfile to trace, data files,
tempfile, and redolog files.
$ sqlplus /nolog
$ SQL> connect / as sysdba
$ SQL> alter database backup controlfile to trace;
SQL> select name from v$datafile;
NAME
------------------------------ -------------------
/u04/oradata/mydb/system01.dbf
/u04/oradata/mydb/indx01.dbf
...
SQL> select member from v$logfile;    
MEMBER
------------------------------ -------------------
/u02/oradata/servicet/redo03 .log
/u02/oradata/servicet/redo02 .log
...
SQL> select name from v$tempfile;
NAME
------------------------------ -------------------
/u02/oradata/servicet/temp01 .dbf
 
Now, you can shutdown down your database and do your cold backup.
$ SQL> connect / as sysdba
$ SQL> shutdown immediate
Copy all above files to your remote server and locat host where you want to
have your clone.
Then, start your database.
$ SQL> connect / as sysdba
$ SQL> startup
 
2. Shutdown your database.
$ SQL> connect / as sysdba
$ SQL> shutdown immediate;
 
3. Now, you can repeat the process the same as renaming a database.

 

 

 

 
 
Google
 
Web web site