Pular para o conteúdo principal

Move datafiles from Filesystem to ASM

$sqlplus / as sysdba
SQL> alter system set control_files='+DATA' scope=spfile;
SQL> alter system set db_create_file_dest='+DATA' scope=spfile;
SQL> alter system set db_recovery_file_dest='+DATA' scope=spfile;

[oracle@database ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Oct 18 00:06:29 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (not mounted)
RMAN> restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl';
Starting restore at 18-OCT-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA/orcl/controlfile/current.256.764813197
Finished restore at 18-OCT-11
RMAN> exit
Recovery Manager complete.

[oracle@database ~]$ sqlplus / as sysdba
SQL> alter database mount;
Database altered.

[oracle@database ~]$ rman target /
RMAN> backup as copy database format '+DATA';
Starting backup at 18-OCT-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output file name=+DATA/orcl/datafile/system.257.764813279 tag=TAG20111018T000759 RECID=1 STAMP=764813326
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
output file name=+DATA/orcl/datafile/sysaux.258.764813335 tag=TAG20111018T000759 RECID=2 STAMP=764813375
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
output file name=+DATA/orcl/datafile/undotbs1.259.764813381 tag=TAG20111018T000759 RECID=3 STAMP=764813399
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=+DATA/orcl/controlfile/backup.260.764813405 tag=TAG20111018T000759 RECID=4 STAMP=764813406
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
output file name=+DATA/orcl/datafile/users.261.764813409 tag=TAG20111018T000759 RECID=5 STAMP=764813408
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 18-OCT-11
channel ORA_DISK_1: finished piece 1 at 18-OCT-11
piece handle=+DATA/orcl/backupset/2011_10_18/nnsnf0_tag20111018t000759_0.262.764813409 tag=TAG20111018T000759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 18-OCT-11

RMAN> switch database to copy;
using target database control file instead of recovery catalog
datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.257.764813279"
datafile 2 switched to datafile copy "+DATA/orcl/datafile/sysaux.258.764813335"
datafile 3 switched to datafile copy "+DATA/orcl/datafile/undotbs1.259.764813381"
datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.261.764813409"

SQL> select NAME from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/datafile/system.257.764813279
+DATA/orcl/datafile/sysaux.258.764813335
+DATA/orcl/datafile/undotbs1.259.764813381
+DATA/orcl/datafile/users.261.764813409

RMAN> recover database;
Starting recover at 18-OCT-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-OCT-11

[oracle@database ~]$ sqlplus / as sysdba
SQL> alter database open;
Database altered.


Redo Logs:
SQL> select group#,status,type,member from v$logfile where group# =2;
    GROUP# STATUS  TYPE    MEMBER
---------- ------- ------- ---------------------------------------------
         2         ONLINE  /u01/app/oracle/oradata/orcl/redo02.log

SQL> select group#,status,sequence#,bytes from v$log;
    GROUP# STATUS            SEQUENCE#      BYTES
---------- ---------------- ---------- ----------
         1 CURRENT                  28   52428800
         2 INACTIVE                 26   52428800
         3 UNUSED                    0   52428800

SQL> select group#,status,type,member from v$logfile where group# =2;
    GROUP# STATUS  TYPE    MEMBER
---------- ------- ------- ---------------------------------------------
         2         ONLINE  /u01/app/oracle/oradata/orcl/redo02.log

SQL> alter database drop logfile group 2;
Database altered.

SQL> alter database add logfile group 2 size 50m;
Database altered.

SQL> select group#,status,sequence#,bytes from v$log;
    GROUP# STATUS            SEQUENCE#      BYTES
---------- ---------------- ---------- ----------
         1 CURRENT                  28   52428800
         2 UNUSED                    0   52428800
         3 UNUSED                    0   52428800

SQL> select group#,status,type,member from v$logfile where group# =2;
    GROUP# STATUS  TYPE    MEMBER
---------- ------- ------- ---------------------------------------------
         2         ONLINE  +DATA/orcl/onlinelog/group_2.265.764814191
         2         ONLINE  +DATA/orcl/onlinelog/group_2.266.764814191


-- TEMP FILES

SQL> select tablespace_name,file_name from dba_temp_files;
TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------------------
TEMP                           /u01/app/oracle/oradata/orcl/temp01.dbf

SQL> alter database tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' drop including datafiles;
Database altered.

SQL> alter tablespace temp add tempfile size 100m  autoextend on next 10m maxsize 2000m;
Tablespace altered.

SQL> select tablespace_name,file_name from dba_temp_files;
TABLESPACE_NAME                FILE_NAME
------------------------------ ----------------------------------------
TEMP                           +DATA/orcl/tempfile/temp.267.764814889

Comentários

Postagens mais visitadas deste blog

Index SKIP SCAN???

Index Skip Scan nada mais é que o "split" logico de um indice composto, ou seja, se sua clausula WHERE não tiver todos os campos do indice composto, ele é dividido em menores sub-indices Exemplo: -------- SQL> create table teste(a number,b number); Table created. SQL> begin 2 for i in 1..1000 3 loop 4 insert into teste values(i, 56); 5 end loop; 6 end; 7 / PL/SQL procedure successfully completed. SQL> create index idx_teste on teste(a,b); Index created. SQL> analyze table teste compute statistics; Table analyzed. SQL> explain plan for select /*+ index_ss(teste idx_teste) */ * from teste where b=56; Explained. SQL> start ?\rdbms\admin\utlxpls.sql -------------------------------------------------------------------------------- | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop | -------------------------------------------------------------------------------- | SELECT STATEMENT | | 1

Webcenter Content - Jython to Checkin Content with Attachments (CHECKIN_NEW_WITH_RENDITIONS)

In the last few days, i had to load a content that, by its requirements, needs to attach files to the content. My first alternative would be Batch Loading, however for the bacth loder file it was not possible because it does not actually support the rendition service. With the next option, i tried to use the IdcCommand, but still had many problems, such as errors below: sample hda file: [oracle @ hostname bin] $ cat idctst.txt @Properties LocalData IdcService = EDIT_RENDITIONS dID = 37020 renditionKeys = addRendition0 addRendition0.name = test543 addRendition0.action = edit addRendition0.file = test.txt addRendition0.file: path = / u01 / oracle / domains / content_domain / ucm / cs / vault / ~ temp / test.txt @end << EOD >> Executing: [oracle @ hostname bin] $ ./IdcCommand -f idctst.txt -u sysadmin -l log.log -c server Error: Java HotSpot (TM) 64-Bit Server VM warning: Using the ParNew young collector with the Serial old collector is deprecated and w

Configurar Tamanho de UNDO e tempo de RETENÇÃO (UNDO_RETENTION)

-- Tamanho Undo Atual SELECT SUM(a.bytes) "UNDO_SIZE" FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO' AND c.status = 'ONLINE' AND b.name = c.tablespace_name AND a.ts# = b.ts#; -- Blocos de UNDO por Seg. SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) "UNDO_BLOCK_PER_SEC" FROM v$undostat; --Tamanho do Bloco SELECT TO_NUMBER(value) "DB_BLOCK_SIZE [KByte]" FROM v$parameter WHERE name = 'db_block_size'; -- Select calcula UNDO RETENTION SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]", SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]", ROUND((d.undo_size / (to_number(f.value) * g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION [Sec]" FROM ( SELECT SUM(a.bytes) undo_size FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO'