Oracle Logbook

November 15, 2007

Cookbook for rename owner

Filed under: Uncategorized — heliodias @ 5:39 am

First i must advice that i didn´t recommend that nobody do this on a production environment. 

All you need to do is make a simple update on dictionary. 

SQL> SELECT COUNT(*) FROM DBA_OBJECTS WHERE OWNER=’HELIO’;

  COUNT(*)                                                                     
———-                                                                     
         1                                                                     

SQL> SELECT OBJECT_NAME,OBJECT_TYPE FROM DBA_OBJECTS WHERE OWNER=’HELIO’;

OBJECT_NAME         OBJECT_TYPE                                                               
—————-    ——————-                                                            
T1                  TABLE                                                                          
                                                                               

SQL> SELECT OWNER# FROM SYS.OBJ$ WHERE NAME=’T1′;

    OWNER#                                                                     
———-                                                                     
        37                                                                     

SQL> SELECT OWNER FROM DBA_OBJECTS WHERE OBJECT_NAME=’T1′;

OWNER                                                                          
——————————                                                 
HELIO                                                                          

SQL> UPDATE SYS.OBJ$ SET OWNER#=10 WHERE NAME=’T1′;

1 linha atualizada.
SQL> SELECT OWNER# FROM OBJ$ WHERE NAME=’OBJ$’;

    OWNER#                                                                     
———-                                                                     
         0                                                                     

SQL> UPDATE SYS.OBJ$ SET OWNER#=0 WHERE NAME=’T1′;

1 linha atualizada.

SQL> SELECT OWNER FROM DBA_OBJECTS WHERE OBJECT_NAME=’T1′;

OWNER                                                                          
——————————                                                 
SYS                                                                            

SQL> SELECT COUNT(*) FROM DBA_OBJECTS WHERE OWNER=’HELIO’;

  COUNT(*)                                                                     
———-                                                                     
         0                                                                     

SQL> COMMIT;

Commit concluído.

SQL> SHUTDOWN IMMEDIATE;
Banco de dados fechado.
Banco de dados desmontado.
Instância ORACLE desativada.
SQL> STARTUP OPEN
Instância ORACLE iniciada.

Total System Global Area  146800640 bytes                                      
Fixed Size                  1286220 bytes                                      
Variable Size              92278708 bytes                                      
Database Buffers           50331648 bytes                                      
Redo Buffers                2904064 bytes                                      
Banco de dados montado.
Banco de dados aberto.
SQL> SELECT OWNER FROM DBA_OBJECTS WHERE OBJECT_NAME=’T1′;

OWNER                                                                          
——————————                                                 
SYS   

Advertisements

November 14, 2007

Cloning manually a database with hot backup

Filed under: Uncategorized — heliodias @ 4:07 pm

http://www.shutdownabort.com/quickguides/clone_hot.php

Create a free website or blog at WordPress.com.