Tablespace and datafiles
I have 3 test databases with Oracle 11.2.3 on the same box
data.dbf and index.dbf were deleted from 2 of the databases in SQL and now EP Manager can't get to any of the tablespaces. when clicking on Server - Tablespace i get the following error:
java.sql.SQLException: ORA-01116: error in opening database file 2 ORA-01110: data file 2: '/u02/oradata/LAWTEST/dev_data01.dbf' ORA-27041: unable to open file IBM AIX RISC System/6000 Error: 2: No such file or directory Additional information: 3 Additional information: 4 Additional information: 4194304
I have tried dropping the tablespaces and refreshing the database from a Prod backup but no luck and have been searching the web for any info.
Any help would be greatly appreciated.
Hi,
I would like to ask where is stored in the database
the information regarding the tablespace and
datafiles (for example for a tablespace which
datafiles belong?). Is it in controlfile? I think no.
Where is it?
Thank you,
MihaelaHi,
You may query DBA_TABLESPACES or V$TABLESPACE to views to gain information on tablespaces. Similarly, DBA_DATA_FILES and V$DATAFILE views will list you the details related to the data files like tablespace name/id, file location ......etc..
Regards
Similar Messages
-
Tablespace and Datafiles... HELP
Hi, I3m new to Oracle, I3m trying to install Oracle 8.1.5 under
Tru64 UNIX, I3m having a hard time creating the Tablespace and
Datafiles to the oracle User... I cannot find documentation
about it, can somebody here tell me how to do it????, it3s
urgent, Please HELP mee!!!!
nullHi Ruben,
I'm an Ora admin working under NT.
Use oracle server manager to create datafiles & tablespaces.
You can find the executable file name for oracle server manager
(svrmgr??.exe for NT) under BIN irectory of ORACLE HOME.
Hope this will be tip for you.
Regards
Sukumar
Ruben Gomez (guest) wrote:
: Hi, I3m new to Oracle, I3m trying to install Oracle 8.1.5 under
: Tru64 UNIX, I3m having a hard time creating the Tablespace and
: Datafiles to the oracle User... I cannot find documentation
: about it, can somebody here tell me how to do it????, it3s
: urgent, Please HELP mee!!!!
null -
Database Performance (Tablespaces and Datafiles)
Hi guys!
What's the best for performance in database, tablespace with various datafiles distribuited in diferents filesystems or tablespaces with various datafiles in only one filesystem?
Thanks,
AugustoIt depends on contents of the tablespaces, tablespace level LOGGING/NOLOGGING and env such as either OLTP or OLAP and LUN presentation to the server with RAID or without RAID and SAN Read per second and write per second.
In general, tablespace with various datafiles distribuited in diferents filesystems/LUN's is in practice for non dev/system test databases.
Moreover using ASM is better then standard filesystems.
Regards,
Kamalesh -
Drop a tablespace and datafile when database is mounted
I tried to import data in my oracle 11g. It failed midway. I presumed that i did not size the redolog properly. Now my database cannot go beyound the mounted mode.
ORA-01157: cannot identify/lock data file 7 – see DBWR trace file
ORA-01110: data file 7: ‘ /data1/owprojects/xxxxx.dbf ‘
Its a new oracle installation and i do not need the corrupt datafile.
I cant take the tablespace offline neither can i drop the tablespace including its contents.
Do i drop from the Linux OS. If yes which other file to i edit to remove the pointer to this tablespace.
Thanks and Best Regards
JTry:
alter database datafile 7 offline for drop;Example:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1388352 bytes
Variable Size 658505920 bytes
Database Buffers 406847488 bytes
Redo Buffers 4591616 bytes
Database mounted.
SQL>
SQL> alter database open;
alter database open
ERROR at line 1:
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: 'C:\TEMP\TEST01.DBF'
SQL> alter database datafile 5 offline for drop;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 396
Next log sequence to archive 397
Current log sequence 397
SQL> alter tablespace test drop datafile 5;
alter tablespace test drop datafile 5
ERROR at line 1:
ORA-03261: the tablespace TEST has only one file
SQL> drop tablespace test;
Tablespace dropped.
SQL>Please read http://docs.oracle.com/cd/E11882_01/server.112/e25494/dfiles004.htm#ADMIN11428.
Edited by: P. Forstmann on 19 mars 2012 18:53 -
Tablespace and datafile hot backup
Hi,
I wanted to if there is a command to copy a datafile using sqlplus command. I making a script that will backup the database while its online.I made a script for the alter tablespace begin backup but I wanted to know how to copy the datafiles without using the OS command,instead I wanted to use a sql commands. Is there any script or procedure to do this one.
thanks
Best Regards,
AntokRMAN is the best utility to do the backup and recover activities. It take care copy and paste itself. Bellow given script is also usefull for hot backup
spool hotbackup_PROD3.sql;
set feedback off;
set verify off;
set pagesize 2500
set linesize 132
set serveroutput on size 50000;
declare
cursor tablespace is select tablespace_name from dba_tablespaces where tablespace_name
in('RBS1',
'STORAGE',
'SYSADM_IDX2',
'SYSADM_IDX3',
'SYSADM_IDX4',
'SYSTEM');
cursor datafile(tsname varchar2 ) is select file_name from dba_data_files
where tablespace_name = tsname;
begin
dbms_output.put_line('spool hotbackup_PRODc.log;');
dbms_output.put_line('alter system switch logfile;');
dbms_output.put_line('select ''log''||sequence#,sysdate from v$log where status = ''CURRENT'';
for tsname in tablespace
loop
dbms_output.put_line('alter tablespace '||tsname.tablespace_name||' begin backup;');
dbms_output.put_line('prompt Starting Backup for '||tsname.tablespace_name||' Tablespace')
for dname in datafile(tsname.tablespace_name)
loop
dbms_output.put_line('prompt Copying File '||dname.file_name||'.....');
dbms_output.put_line('!cp '||dname.file_name||' /backup2/hotbak'||dname.file_name);
end loop;
dbms_output.put_line('alter tablespace '||tsname.tablespace_name||' end backup;');
dbms_output.put_line('prompt Finished backing up '||tsname.tablespace_name||' Tablespace')
dbms_output.put_line('alter system switch logfile;');
end loop;
dbms_output.put_line('spool off;');
dbms_output.put_line('!mailx -s "KL_PROD521_HOTBACKUP1" [email protected] < /prod1/HOTBKUP/hotbackup_PRODc.log');
dbms_output.put_line('exit');
end;
spool off;
@hotbackup_PROD3.sql
exit; -
Use of backing up a single tablespace or datafile
Hello,
I am reading the RMAN manual and I'm quite familiar with backup up a tablespace or datafile, but I can find very few uses for that. Backup up a tablespace is useful for TPITR, but since that needs another instance its of very little use in most production environments. I think you cannot restore an old version of tablespace in a normal database, unless the tablespace has long been made read-only, in which case RMAN's optimizations will do the trick.
Even less use I can find for datafile backup. I have absolutely no idea what you can do with a single datafile.
Can you please clarify me on the uses of these RMAN features?
Thank you.Dear Albi!
Think of the following scenario:
You have a very large (let's say 1 Terabyte) production database that is split into n tablespaces. This database is in archivelog mode and a full backup of the hole database would take more than 10 hours.
scenario end.
In such a scenario I think you will not take a full database backup very often. Therfore you can backup portions (tablespaces and datafiles) of your database. This will take less time then a hole DBbackup.
If you have to restore your DB then RMAN will take all the files it needs from all your backup. RMAN uses always the most actual version of your datafiles. After the restore RMAN will take the archivelogs to recover all datafiles to the most actual point in time. And that's the point why partial backups of your db are not only usefull for TSPITR.
I hope I could make clear what the operative point is with partial backups.
Yours sincerely
Florian W. -
Administer datafiles, tablespaces and free space
Hi all,
Firstly i want to apologize if my English is not very good, and secondly for if there is such topic already. I tried the "search" but didn't find something that suits my requirements...
We are using Oracle9i.
Here is the (potential) problem:
I noticed that the some of the filesystems soon will run out of space.
Example:
/dev/vg07/lv_data7 71671808 68657701 2825782 96% /var/application/oracle/data07
/dev/vg07/lv_data6 71671808 58102994 12720766 82% /var/application/oracle/data06
/dev/vg07/lv_data5 71671808 69448894 2084034 97% /var/application/oracle/data05
/dev/vg07/lv_data4 71671808 67765635 3662100 95% /var/application/oracle/data04
/dev/vg06/lv_data3 71675904 65840498 5470722 92% /var/application/oracle/data03
/dev/vg05/lv_data2 71675904 65730929 5573472 92% /var/application/oracle/data02
/dev/vg03/lv_data1 70656000 65924095 4436216 94% /var/application/oracle/data01
/dev/vg10/lv_data10 292929536 7301210 267776605 3% /var/application/oracle/data10
/dev/vg10/lv_data11 292929536 0 292929536 0% /var/application/oracle/data11
Lets for example take a look at data05:
/var/application/oracle/data05 > ls -l
There are many tablespaces and some of their datafiles there.
-rw-r----- 1 oracle dba 367005696 Jul 21 13:19 e1_data_d_d_11.dbf
-rw-r----- 1 oracle dba 209719296 Jul 21 13:20 e1_data_d_d_12.dbf
-rw-r----- 1 oracle dba 1022365696 Jul 21 13:19 m_data_d_07.dbf
-rw-r----- 1 oracle dba 812650496 Jul 21 13:19 m_data_d_08.dbf
-rw-r----- 1 oracle dba 707792896 Jul 21 13:19 m_data_d_09.dbf
-rw-r----- 1 oracle dba 2097156096 Jul 21 13:19 e_data_d_30.dbf
-rw-r----- 1 oracle dba 734007296 Jul 21 13:20 e_data_d_38.dbf
-rw-r----- 1 oracle dba 629149696 Jul 21 13:20 e_data_d_39.dbf
-rw-r----- 1 oracle dba 419434496 Jul 21 13:20 e_data_d_40.dbf
-rw-r----- 1 oracle dba 812650496 Jul 21 13:25 m1_data_d_03.dbf
-rw-r----- 1 oracle dba 393220096 Jul 21 13:27 m1_data_d_04.dbf
-rw-r----- 1 oracle dba 209719296 Jul 21 13:20 m1_data_d_05.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:19 m1_data__03.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:39 m1_data__04.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:19 m1_data__05.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:39 m1_data__06.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:19 m3_data_d_d_03.dbf
-rw-r----- 1 oracle dba 2097160192 Jul 21 13:42 m3_data_d_d_04.dbf
-rw-r----- 1 oracle dba 1572872192 Jul 21 13:20 m3_data_d_d_05.dbf
drwxr-xr-x 2 root root 96 Nov 21 2006 lost+found
-rw-r----- 1 oracle dba 942678016 Jul 21 13:19 system02.dbf
-rw-r----- 1 oracle dba 72359936 Jul 21 13:20 system04.dbf
The situation is similar in the other filesystems - various tablespaces and a lot of datafiles.
Perhaps you've noticed that /data10 and /data11 are empty.
What is the best approach in this situation so that we start using those two filesystems .
Is moving datafiles from heavily used filesystems to the empty ones there is a good solution?
My idea is to make Oracle to automatically extend the tabespaces over the empty volumes and start creating the new datafiles there, but i am not sure how exactly to do that.
Any help will be appreciated.
Regards.
/R
Message was edited by:
user648100Thanks for the quick reply.
MYH,
Yes, the tablespaces are autoextend on. Here is the information about one of them from the GridControl:
Name e1_data_d_d
Status ReadWrite
Type Permanent
Extent Management local
Storage
Allocation Type Automatic
Segment Space Management Automatic
Enable logging Yes
Block Size (B) 4096
I did not understand the second question - about partition a datafile?!? I can move datafiles but i'm still learning... never heard of partitioning a file, sorry.
Yas, i think the datafiles are Oracle Managed and oracle, after filling up a file, creates the new datafile automatically. I can create new file within the empty filesystems, but isn't it dangerous.
And with regards to same question - if i create a new datafiles, or move old datafiles - will Oracle start to use the new filesystems automatically? -
Control file lost and datafile addeed restore/recovery with no data loss
Here i have tried to the following
created new table called t2 and made sure data went to a specific tablespace...
took a level 0 backup
removed the control file
added couple of datafile to above tablespace and then inserted more data
then went out to restore control file and the database...but datafile still could not be opened ?? what did i do wrong here....
SQL> @datafile
-- list of datafile
Tablespace File Typ Tablespac File Stat Used MB Free MB FILE_MB MAXMB Datafile_name FILE_ID AUT
UNDOTBS1 Datafile ONLINE AVAILABLE 16 84 100 1,024 /data/trgt/undotbs01.dbf 3 YES
USERS Datafile ONLINE AVAILABLE 1153 895 2048 3,072 /data3/trgt/user02.dbf 5 YES
CNT_TST Datafile ONLINE AVAILABLE 1 9 10 0 /data3/trgt/cnt_tst01.dbf 7 NO
SYSAUX Datafile ONLINE AVAILABLE 626 35 660 32,768 /data/trgt/sysaux01.dbf 2 YES
USERS Datafile ONLINE AVAILABLE 2031 17 2048 2,048 /data3/trgt/move/users01.dbf 4 YES
SYSTEM Datafile ONLINE AVAILABLE 712 58 770 32,768 /data/trgt/system01.dbf 1 YES
USERS Datafile ONLINE AVAILABLE 65 35 100 32,768 /data3/trgt/users03.dbf 6 YES
7 rows selected.
-- new table is created called t2 and its going into TS called cnt_tst
SQL> CREATE TABLE TEST.T2
C1 DATE,
C2 NUMBER,
C3 NUMBER,
C4 VARCHAR2(300 BYTE)
TABLESPACE cnt_tst; 2 3 4 5 6 7 8
Table created.
-- data inserted
SQL> INSERT INTO
test.T2
SELECT
FROM
(SELECT
SYSDATE,
ROWNUM C2,
DECODE(MOD(ROWNUM,100),99,99,1) C3,
RPAD('A',300,'A') C4
FROM
DUAL
CONNECT BY
LEVEL <= 10000)
; 2 3 4 5 6 7 8 9 10 11 12 13 14 15
10000 rows created.
SQL> commit;
Commit complete.
-- to check of cnt_tst has any free space or not, as we can see its full
SQL> @datafile
Tablespace File Typ Tablespac File Stat Used MB Free MB FILE_MB MAXMB Datafile_name FILE_ID AUT
UNDOTBS1 Datafile ONLINE AVAILABLE 16 84 100 1,024 /data/trgt/undotbs01.dbf 3 YES
USERS Datafile ONLINE AVAILABLE 1153 895 2048 3,072 /data3/trgt/user02.dbf 5 YES
SYSAUX Datafile ONLINE AVAILABLE 626 35 660 32,768 /data/trgt/sysaux01.dbf 2 YES
USERS Datafile ONLINE AVAILABLE 2031 17 2048 2,048 /data3/trgt/move/users01.dbf 4 YES
SYSTEM Datafile ONLINE AVAILABLE 712 58 770 32,768 /data/trgt/system01.dbf 1 YES
USERS Datafile ONLINE AVAILABLE 65 35 100 32,768 /data3/trgt/users03.dbf 6 YES
CNT_TST Datafile ONLINE AVAILABLE 10 0 10 0 /data3/trgt/cnt_tst01.dbf 7 NO
7 rows selected.
SQL> select count(*) from test.t2;
COUNT(*)
10000
1 row selected.
-- to get a count and max on date
SQL> select max(c1) from test.t2;
MAX(C1)
29-feb-12 13:47:52
1 row selected.
SQL> -- AT THIS POINT A LEVEL 0 BACKUP IS TAKEN (using backup database plus archivelog)
SQL> -- now control files are removed
SQL> select name from v$controlfile;
NAME
/ctrl/trgt/control01.ctl
/ctrl/trgt/control02.ctl
2 rows selected.
SQL>
SQL> ! rm /ctrl/trgt/control01.ctl
SQL> ! rm /ctrl/trgt/control02.ctl
SQL> ! ls -ltr /ctrl/trgt/
ls: /ctrl/trgt/: No such file or directory
SQL>
-- new datafile is added to CNT_TST TABLESPACE and new data is added as well
SQL> ALTER TABLESPACE CNT_TST ADD DATAFILE '/data3/trgt/CNT_TST02.dbf' SIZE 100M AUTOEXTEND OFF;
Tablespace altered.
SQL> ALTER SYSTEM CHECKPOINT;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> ALTER TABLESPACE CNT_TST ADD DATAFILE '/data3/trgt/CNT_TST03.dbf' SIZE 100M AUTOEXTEND OFF;
Tablespace altered.
SQL> INSERT INTO
test.T2
SELECT
FROM
(SELECT
SYSDATE,
ROWNUM C2,
DECODE(MOD(ROWNUM,100),99,99,1) C3,
RPAD('A',300,'A') C4
FROM
DUAL
CONNECT BY
LEVEL <= 10000)
; 2 3 4 5 6 7 8 9 10 11 12 13 14 15
10000 rows created.
SQL> /
10000 rows created.
SQL> commit;
Commit complete.
SQL> INSERT INTO
test.T2
SELECT
FROM
(SELECT
SYSDATE,
ROWNUM C2,
DECODE(MOD(ROWNUM,100),99,99,1) C3,
RPAD('A',300,'A') C4
FROM
DUAL
CONNECT BY
LEVEL <= 40000)
; 2 3 4 5 6 7 8 9 10 11 12 13 14 15
40000 rows created.
SQL> commit;
Commit complete.
SQL> @datafile
-- to make sure new datafile has been registered with the DB
Tablespace File Typ Tablespac File Stat Used MB Free MB FILE_MB MAXMB Datafile_name FILE_ID AUT
CNT_TST Datafile ONLINE AVAILABLE 9 91 100 0 /data3/trgt/CNT_TST03.dbf 9 NO
UNDOTBS1 Datafile ONLINE AVAILABLE 16 84 100 1,024 /data/trgt/undotbs01.dbf 3 YES
USERS Datafile ONLINE AVAILABLE 1153 895 2048 3,072 /data3/trgt/user02.dbf 5 YES
CNT_TST Datafile ONLINE AVAILABLE 9 91 100 0 /data3/trgt/CNT_TST02.dbf 8 NO
SYSAUX Datafile ONLINE AVAILABLE 626 35 660 32,768 /data/trgt/sysaux01.dbf 2 YES
USERS Datafile ONLINE AVAILABLE 2031 17 2048 2,048 /data3/trgt/move/users01.dbf 4 YES
SYSTEM Datafile ONLINE AVAILABLE 712 58 770 32,768 /data/trgt/system01.dbf 1 YES
USERS Datafile ONLINE AVAILABLE 65 35 100 32,768 /data3/trgt/users03.dbf 6 YES
CNT_TST Datafile ONLINE AVAILABLE 10 0 10 0 /data3/trgt/cnt_tst01.dbf 7 NO
9 rows selected.
-- now the count and max ... note count before backup was 10000 and max(c1) was diff
SQL> select count(*) from test.t2;
COUNT(*)
70000
1 row selected.
SQL> select max(c1) from test.t2;
MAX(C1)
29-feb-12 13:58:25
1 row selected.
SQL> -- now restore starts
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@berry trgt]$ rman
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Feb 29 14:01:48 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> connect catalog rman/pass@rcat
connected to recovery catalog database
RMAN> connect target /
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 188313600 bytes
Fixed Size 1335388 bytes
Variable Size 125833124 bytes
Database Buffers 58720256 bytes
Redo Buffers 2424832 bytes
RMAN> restore controlfile from autobackup;
Starting restore at 29-FEB-12 14:02:37
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
recovery area destination: /backup/trgt/flash_recovery_area
database name (or database unique name) used for search: TRGT
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120229
channel ORA_DISK_1: AUTOBACKUP found: /backup/trgt/backup/cont_c-3405317011-20120229-09
channel ORA_DISK_1: restoring control file from AUTOBACKUP /backup/trgt/backup/cont_c-3405317011-20120229-09
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/ctrl/trgt/control01.ctl
output file name=/ctrl/trgt/control02.ctl
Finished restore at 29-FEB-12 14:02:39
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> recover database;
Starting recover at 29-FEB-12 14:02:55
Starting implicit crosscheck backup at 29-FEB-12 14:02:55
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 96 objects
Finished implicit crosscheck backup at 29-FEB-12 14:02:57
Starting implicit crosscheck copy at 29-FEB-12 14:02:57
using channel ORA_DISK_1
Finished implicit crosscheck copy at 29-FEB-12 14:02:57
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 13 is already on disk as file /redo_archive/trgt/online/redo01.log
archived log for thread 1 with sequence 14 is already on disk as file /redo_archive/trgt/online/redo02.log
archived log for thread 1 with sequence 15 is already on disk as file /redo_archive/trgt/online/redo03.log
archived log file name=/redo_archive/trgt/archive/1_10_776523284.dbf thread=1 sequence=10
archived log file name=/redo_archive/trgt/archive/1_10_776523284.dbf thread=1 sequence=10
archived log file name=/redo_archive/trgt/archive/1_11_776523284.dbf thread=1 sequence=11
archived log file name=/redo_archive/trgt/archive/1_12_776523284.dbf thread=1 sequence=12
archived log file name=/redo_archive/trgt/online/redo01.log thread=1 sequence=13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/29/2012 14:02:59
ORA-01422: exact fetch returns more than requested number of rows
RMAN-20505: create datafile during recovery
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/redo_archive/trgt/online/redo01.log'
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery
ORA-01110: data file 9: '/data3/trgt/CNT_TST03.dbf'
RMAN> -- wnet to session 2 and renamed datafile from unammed-- wnet to session 2 and renamed datafile for unammed file
SQL> select name from v$datafile;
NAME
/data/trgt/system01.dbf
/data/trgt/sysaux01.dbf
/data/trgt/undotbs01.dbf
/data3/trgt/move/users01.dbf
/data3/trgt/user02.dbf
/data3/trgt/users03.dbf
/data3/trgt/cnt_tst01.dbf
/oracle/app/product/11.2.0/dbhome_1/dbs/UNNAMED00008
/oracle/app/product/11.2.0/dbhome_1/dbs/UNNAMED00009
9 rows selected.
SQL> alter database create datafile '/oracle/app/product/11.2.0/dbhome_1/dbs/UNNAMED00008' as '/data3/trgt/CNT_TST02.dbf';
Database altered.
SQL> alter database create datafile '/oracle/app/product/11.2.0/dbhome_1/dbs/UNNAMED00009' as '/data3/trgt/CNT_TST03.dbf';
Database altered.
SQL> select name from v$datafile;
NAME
/data/trgt/system01.dbf
/data/trgt/sysaux01.dbf
/data/trgt/undotbs01.dbf
/data3/trgt/move/users01.dbf
/data3/trgt/user02.dbf
/data3/trgt/users03.dbf
/data3/trgt/cnt_tst01.dbf
/data3/trgt/CNT_TST02.dbf
/data3/trgt/CNT_TST03.dbf
9 rows selected.after above was done, went back to session 1 and tried recovered the DB
RMAN> recover database;
Starting recover at 29-FEB-12 14:06:16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 13 is already on disk as file /redo_archive/trgt/online/redo01.log
archived log for thread 1 with sequence 14 is already on disk as file /redo_archive/trgt/online/redo02.log
archived log for thread 1 with sequence 15 is already on disk as file /redo_archive/trgt/online/redo03.log
archived log file name=/redo_archive/trgt/online/redo01.log thread=1 sequence=13
archived log file name=/redo_archive/trgt/online/redo02.log thread=1 sequence=14
archived log file name=/redo_archive/trgt/online/redo03.log thread=1 sequence=15
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-FEB-12 14:06:17
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
starting full resync of recovery catalog
full resync complete
RMAN> exit
Recovery Manager complete.
[oracle@berry trgt]$
[oracle@berry trgt]$
[oracle@berry trgt]$ sq
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 29 14:07:18 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter session set NLS_DATE_FORMAT="dd-mon-yy hh24:mi:ss:
2
SQL>
SQL> alter session set NLS_DATE_FORMAT="dd-mon-yy hh24:mi:ss";
Session altered.
SQL> select count(*) from test.t2;
select count(*) from test.t2
ERROR at line 1:
ORA-00376: file 8 cannot be read at this time
ORA-01110: data file 8: '/data3/trgt/CNT_TST02.dbf'
SQL> select max(c1) from test.t2;
select max(c1) from test.t2
ERROR at line 1:
ORA-00376: file 8 cannot be read at this time
ORA-01110: data file 8: '/data3/trgt/CNT_TST02.dbf'
SQL> alter database datafile 8 online;
alter database datafile 8 online
ERROR at line 1:
ORA-01190: control file or data file 8 is from before the last RESETLOGS
ORA-01110: data file 8: '/data3/trgt/CNT_TST02.dbf'
{code}
so what did i do wrong in my recovery that i could not get my data?? how can i avoid this?? and restore my DB?
Edited by: user8363520 on Feb 29, 2012 12:24 PMuser8363520 wrote:
Here i have tried to the following
created new table called t2 and made sure data went to a specific tablespace...
took a level 0 backup
removed the control file
added couple of datafile to above tablespace and then inserted more data
then went out to restore control file and the database...but datafile still could not be opened ?? what did i do wrong here....
SQL> @datafile
-- list of datafile
Tablespace File Typ Tablespac File Stat Used MB Free MB FILE_MB MAXMB Datafile_name FILE_ID AUT
UNDOTBS1 Datafile ONLINE AVAILABLE 16 84 100 1,024 /data/trgt/undotbs01.dbf ; 3 YES
USERS Datafile ONLINE AVAILABLE 1153 895 2048 3,072 /data3/trgt/user02.dbf ; 5 YES
CNT_TST Datafile ONLINE AVAILABLE 1 9 10 0 /data3/trgt/cnt_tst01.dbf ; 7 NO
SYSAUX Datafile ONLINE AVAILABLE 626 35 660 32,768 /data/trgt/sysaux01.dbf ; 2 YES
USERS Datafile ONLINE AVAILABLE 2031 17 2048 2,048 /data3/trgt/move/users01.dbf ; 4 YES
SYSTEM Datafile ONLINE AVAILABLE 712 58 770 32,768 /data/trgt/system01.dbf ; 1 YES
USERS Datafile ONLINE AVAILABLE 65 35 100 32,768 /data3/trgt/users03.dbf ; 6 YES
7 rows selected.
-- new table is created called t2 and its going into TS called cnt_tst
SQL> CREATE TABLE TEST.T2
C1 DATE,
C2 NUMBER,
C3 NUMBER,
C4 VARCHAR2(300 BYTE)
TABLESPACE cnt_tst; 2 3 4 5 6 7 8
Table created.
-- data inserted
SQL> INSERT INTO
test.T2
SELECT
FROM
(SELECT
SYSDATE,
ROWNUM C2,
DECODE(MOD(ROWNUM,100),99,99,1) C3,
RPAD('A',300,'A') C4
FROM
DUAL
CONNECT BY
LEVEL <= 10000)
; 2 3 4 5 6 7 8 9 10 11 12 13 14 15
10000 rows created.
SQL> commit;
Commit complete.
-- to check of cnt_tst has any free space or not, as we can see its full
SQL> @datafile
Tablespace File Typ Tablespac File Stat Used MB Free MB FILE_MB MAXMB Datafile_name FILE_ID AUT
UNDOTBS1 Datafile ONLINE AVAILABLE 16 84 100 1,024 /data/trgt/undotbs01.dbf ; 3 YES
USERS Datafile ONLINE AVAILABLE 1153 895 2048 3,072 /data3/trgt/user02.dbf ; 5 YES
SYSAUX Datafile ONLINE AVAILABLE 626 35 660 32,768 /data/trgt/sysaux01.dbf ; 2 YES
USERS Datafile ONLINE AVAILABLE 2031 17 2048 2,048 /data3/trgt/move/users01.dbf ; 4 YES
SYSTEM Datafile ONLINE AVAILABLE 712 58 770 32,768 /data/trgt/system01.dbf ; 1 YES
USERS Datafile ONLINE AVAILABLE 65 35 100 32,768 /data3/trgt/users03.dbf ; 6 YES
CNT_TST Datafile ONLINE AVAILABLE 10 0 10 0 /data3/trgt/cnt_tst01.dbf ; 7 NO
7 rows selected.
SQL> select count(*) from test.t2;
COUNT(*)
10000
1 row selected.
-- to get a count and max on date
SQL> select max(c1) from test.t2;
MAX(C1)
29-feb-12 13:47:52
1 row selected.
SQL> -- AT THIS POINT A LEVEL 0 BACKUP IS TAKEN (using backup database plus archivelog)
SQL> -- now control files are removed
SQL> select name from v$controlfile;
NAME
/ctrl/trgt/control01.ctl
/ctrl/trgt/control02.ctl
2 rows selected.
SQL>
SQL> ! rm /ctrl/trgt/control01.ctl
SQL> ! rm /ctrl/trgt/control02.ctl
SQL> ! ls -ltr /ctrl/trgt/
ls: /ctrl/trgt/: No such file or directory
SQL>
-- new datafile is added to CNT_TST TABLESPACE and new data is added as well
SQL> ALTER TABLESPACE CNT_TST ADD DATAFILE '/data3/trgt/CNT_TST02.dbf' SIZE 100M AUTOEXTEND OFF;
Tablespace altered.
SQL> ALTER SYSTEM CHECKPOINT;
System altered. Upto this i was clear, but now i cann't understand when you actually dropped the control file from you database(in running stat) how can you perform "alter system checkpoint" and other "alter tablespace.." command? Once controlfile is inaccessible, oracle database is not suppose to function. -
To capture all the objects from an tablespace and restore.
Hi All,
I have a situation in the Schema refresh process where i may have to delete a tablespace and its datafiles.
Then I have to recreate it as it was before and restore all it objects .
Is there any way that i can capture all the objects of that tablespace before it is deleted and then later restore it back as it was .
Any Expert sugggestion is highly apprciated .
The Platform is as below ..
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
Thanks In Advance .There are 2 methods you could use with Data Pump.
1. tablespace mode export. expdp user/password tablespaces=<your list here> ...
2. transportable tablespace mode. expdp user/password transport_tablespaces=<your tablespace list here> ...
NOTE: for #2, you need to have your tablespaces in read only mode, then you need to copy the data files, and the
tablespaces need to be self contained.
Hope this helps.
Dean -
Tablespace or datafile creation during recovery
Hello
During recovery,
If there is new tablespace or datafile added in archivelogs or redologs I have to manually issue:
alter database create datafile .. as ..
Why doesnt oracle automatically create the datafiles ?The datafile doesn't exist in the control file. The control file maintains the physical structure of the database. During the RECOVERy phase, Oracle reads the ArchiveLogs to identify what updates are to be done -- these are mapped in terms of file, block and row. If the file doesn't exist in the controlfile, the rollforward cannot be applied.
Therefore, the ALTER DATABASE CREATE DATAFILE ... AS .... allows Oracle to "add' the file to the controlfile and then proceed with the rollforward.
Oracle doesn't automatically create the datafile because it can't know what the target file name is.
In your backup your datafiles may have been spread across /u01/oradata/MYDB, /u02/oradata/MYDB, /u03/oradata/MYDB and this file may have been in /u03/oradata/MYDB. However, in your target (restored) location the files may be at only two, differently named, mountpoints : /oradata1/REPDB, /oradata/REPDB. Oracle can't decide for you where the new datafile (which was in /u03/oradata/MYDB) should be created -- should it be in /oradata1/REPDB or /oradata/REPDB or, you might have avaialable /oradata3/REPDB which the database instance isn't aware of ! -
Tablespace or Datafile in Backup mode
Hi,
Can anyone explain me what happen at the background when a tablespace or a datafile is in backup mode.
Thanks in advance
Regards
Aruna
Edited by: user11144654 on May 8, 2009 3:10 AMThe tablespace is checkpointed, the checkpoint SCN marker in the datafile headers cease to increment with checkpoints, and full images of changed DB blocks are written to the redologs.
Those three actions are all that is required to guarantee consistency once the file is restored and recovery is applied. By freezing the checkpoint SCN in the file headers, any subsequent recovery on that backup copy of the file will know that it must commence at that SCN. Having an old SCN in the file header tells recovery that the file is an old one, and that it should look for the redolog file containing that SCN, and apply recovery starting there. Note that checkpoints to datafiles in hot backup mode are not suppressed during the backup, only the incrementing of the main checkpoint SCN flag. A “hot backup checkpoint” SCN marker in the file header continues to increment as periodic or incremental checkpoints progress normally.
There is a confusing side effect of having the checkpoint SCN artificially frozen at an SCN earlier than the true checkpointed SCN of the datafile. In the event of a system crash or a ‘shutdown abort’ during hot backup of a tablespace, the automatic crash recovery routine at startup will think that the files for that tablespace are quite out of date, and will actually suggest the application of old archived redologs in order to bring them back into sync with the rest of the database. It is unnecessary, in this case, to heed Oracle’s suggestion. With the database started up in mount mode, simply check v$backup and v$datafile to determine which datafiles were in backup mode at the time the database crashed. For each file in backup mode, issue an ‘alter database datafile '<file name>' end backup;’ This action will update the checkpoint SCN in the file headers to be the same as the hot backup checkpoint SCN (which is a true representation of the last SCN to which the datafile is truly checkpointed. Once this action is taken, it allows normal crash recovery to proceed during the ‘alter database open;’ command.
By initially checkpointing the datafiles that comprise the tablespace and logging full block images to redo, Oracle guarantees that any blocks changed in the datafile while in hot backup mode will also be available in the redologs in case they are ever used for a recovery.
It is well understood by much of the Oracle user community that during hot backup mode, a greater volume of redo is generated for changes to the tablespace being backed up than when the tablespace is not in backup mode. This is the result of the logging of full images of changed blocks in these tablespaces to the redologs. Normally, Oracle logs an entry in the redologs for every change in the database, but it does not log the whole image of the database block. By logging full images of changed DB blocks to the redologs during backup mode, Oracle eliminates the possibility of the backup containing irresolvable split blocks. To understand this reasoning, you must first understand what a split block is.
Typically, Oracle database blocks are a multiple of O/S blocks. For instance, most Unix filesystems have a default block size of 512 bytes, while Oracle’s default block size is 2k. This means that the filesystem stores data in 512 byte chunks, while Oracle performs reads and writes in 2k chunks, or multiples thereof. While backing up a datafile, your backup script makes a copy of the datafile from the filesystem, using O/S utilities such as copy, dd, cpio, or OCOPY. As it is making this copy, it is reading in O/S-block sized increments. If the database writer happens to be writing a DB block into the datafile at the same time that your script is reading that block’s constituent O/S blocks, your backup copy of the DB block could contain some O/S blocks from before the database performed the write, and some from after. This would be a split block.
By logging the full block image of the changed block to the redologs, it guarantees that in the event of a recovery, any split blocks that might be in the backup copy of the datafile will be resolved by overlaying them with the full legitimate image of the block from the redologs. Upon completion of a recovery, any blocks that got copied in a split state into the backup will have been resolved through application of full block images from the redologs. -
Tablespace with datafiles on many disks
Hello,
I am using Oracle 11g R2 on AIX 7.1
I am planing to create a tablespace where it is datafiles on 4 disks.
How can I specify a datafile to be on a disk while creating the tablespace?
Regards,NB wrote:
thanks for the info.
No i have no control on the disks.
I am doing that for better performance so I will put each datafile of a tablespace on a disk, and I/O will decrease.
How can I achieve that ?
again if the 4 disks are mounted on a single mount point /u01
Edited by: NB on Mar 17, 2012 11:08 AMRead this.
Consider the Performance Impact_
The number of datafiles contained in a tablespace, and ultimately the database, can have an impact upon performance.
Oracle Database allows more datafiles in the database than the operating system defined limit. The database DBWn processes can open all online datafiles. Oracle Database is capable of treating open file descriptors as a cache, automatically closing files when the number of open file descriptors reaches the operating system-defined limit. This can have a negative performance impact. When possible, adjust the operating system limit on open file descriptors so that it is larger than the number of online datafiles in the database.
Place Datafiles Appropriately_
Tablespace location is determined by the physical location of the datafiles that constitute that tablespace. Use the hardware resources of your computer appropriately.
For example, if several disk drives are available to store the database, consider placing potentially contending datafiles on separate disks.This way, when users query information, both disk drives can work simultaneously, retrieving data at the same time.
Source:-
http://docs.oracle.com/cd/B28359_01/server.111/b28310/dfiles001.htm -
Hello,
1 create tablespace TS1
2 create restore point RP1;
3 drop tablespace TS1 (datafile '/c:/ts1.dbf') including files
4 restore database to RP1
5 alter database open resetlogs failed with this error :
ERROR at line 1:
ORA-01245: offline file 7 will be lost if RESETLOGS is done
ORA-01110: data file 7: '/c:/ts1.dbf'
Can you help me please to fix this issue and to understand why it's occured.Hi,
If you check the alert log you will get message similar to
Recovery deleting file #7:'<Oracle_Home>/db/dbs/UNNAMED00007' from controlfile.
Now you have 2 option
1. If you have backup of that tablespace TS1 then you can restore and recover it
If you don't need that tablespace then you offline drop that datafile 7 . Open the database in resetlogs mode and then drop tablespace TS1
Thank you -
Lost .ARC and media failure on UNDOTBS01 and datafile
Hi,
I have media failure in UNDOTBS01.DBF and .dbf datafile.
Database is 9.2 on windows 2003 server in archiving mode but have lost some .ARC file too.
I have a export of schema EXPLZHPRDBF in good state.
I think to drop user EXPLZHPRDBF , re-create schema and impot from .dmp file but when
go to drop user have some error. I have re-create new UNDOTBS02 undo tablespace, and
ALTER SYSTEM SET undo_tablespace='UNDOTBS2' scope=BOTH;
then startup database but have this problem.
drop USER EXPLZHPRDBF cascade
Error starting at line 1 in command:
drop USER EXPLZHPRDBF cascade
Error report:
SQL Error: ORA-00604: error occurred at recursive SQL level 2
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: 'D:\ORACLE\ORA92\ZHORA01\UNDOTBS01.DBF'
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
what can I do ? have to create a new instance for import good .dmp file or can be other solution ?
Edited by: mauro brn on Oct 7, 2009 3:15 PM
Edited by: mauro brn on Oct 7, 2009 3:16 PMIn case of missing archived files you can not recover your undo tablespace. It's always a good practice to define more than one destination for your archived log files so in case you lose a file at one destination it could be recoverd from another arc destination. There might be some uncommited information present on your lost undo file that required to be rolled back.
If you have an export file available then it's better you create a new database and import your data in the new database. In case of doing import, you are going to lose data that was inserted/updated or deleted after you took the export dump.
http://waqas-dba.blogspot.com -
TEMPORARY TABLESPACE에서, TEMPFILE을 사용할지, DATAFILE을 사용 할지 결정에 필요한 지침
제품 : ORACLE SERVER
작성날짜 : 2003-02-24
TEMPORARY TABLESPACE에서, 임시 파일을 사용할지, 데이터파일을 사용 할지 결정에 필요한 지침
===========================================================================================
PURPOSE
이 문서는, TEMPORARY TABLESPACE에서 임시 파일과 데이터파일의 차이점을
소개하는 데 목적이 있다.
Explanation
| TEMPORARY | Tablespace |
| tablespace | TEMPORARY |
| Locally | Dictionary |
| managed | managed |
| Datafiles | impossible | Y |
| Tempfiles | Y | impossible |
------------------------------------------+
다른 조합은 허용되지 않는다.
1. TEMPORARY Tablespace / Tablespace TEMPORARY 와 PERMANENT tablespace 비교
1) Tablespace TEMPORARY는 오라클 7.3 이상 버젼에서 사용가능하다.
=> Tablespace TEMPORARY는 다음과 같은 명령을 사용하여 생성한다.
CREATE TABLESPACE .. TEMPORARY
이 경우 데이터파일만을 사용한다.
2) TEMPORARY tablespac는 오라클 8i 이상 버젼에서 사용 가능하다
=> TEMPORARY tablespace는 다음과 같은 명령을 사용하여 생성한다
CREATE TEMPORARY TABLESPACE .. TEMPFILE
이 경우 tempfile만 사용할 수 있다.
3) Tablespace TEMPORARY/TEMPORARY tablespace는 DBA_TABLESPACES의
CONTENTS 값이 TEMPORARY로 나타난다.
4) Tablespace TEMPORARY/TEMPORARY tablespace 는 PERMANENT
tablespace와 다르며 (DBA_TABLESPACES.CONTENTS 값이 PERMANENT임)
permanent segment를 생성 할 수 없다. 예를 들어, permanent table이나
index, cluster, rollback segment등을 Tablespace TEMPORARY/TEMPORARY
tablespace에 생성할 수 없다.
5) Tablespace TEMPORARY/TEMPORARY tablespace 에서는, 단일한
temporary segment를 제공하며, 이 세그먼트는 다음과 같은
요구사항을 가진 모든 사용자에 의해 공유된다.
=> sort 작업에 따른 sort extents를 필요로 하는 사용자
=> GLOBAL TEMPORARY TABLE에 필요한 temporary extents
이와 같은 고유한 temporary segment는 동시에 많은 양의 sort 작업이
수행되거나, 여러 트랜잭션이 동일한 temporary table을 사용할 때,
permanent tablespace에서 작업하는 overhead를 피하고, 오라클의
공간 관리 작업의 부하를 피하는데 도움을 준다.
6) Temporary segment는 인스턴스 구동후 사용자가 sort extent나
sort run, 또는 global temporary table 생성등의 요청에 따라
자동적으로 생성된다.
7) Temporary segment는 인스턴스 shutdown시 자동적으로 drop 된다.
8) Temporary Content를 저장하는 테이블스페이스에 대한
세그먼트의 공간 할당/할당 해제 관련 정보는 V$SORT_SEGMENT와
V$SORT_USAGE 뷰를 사용하여 확인해 볼 수 있으며, sort segment
등에 현재 sort를 진행하는 사용 정보를 보여준다.
9) 위와 같은 작업을 수행하는데 PERMANENT tablespace 보다는
tablespace TEMPORARY를 사용하는 것이 유리한 점은 <Bulletin No:
11938>에 자세히 기술되어 있따.
10) 오라클 8i에서는, 사용자별 default temporary tablespace가 어떤
종류라도 상관이 없으나, PERMANENT locally managed 방식의 테이블
스페이스는 지정할 수 없다. 다음은 PERMANENT locally managed 방식의
테이블스페이스를 default temporary tablespace로 지정하여 발생하는
에러이다.
SQL> alter user x temporary tablespace PERM_LOCAL;
User altered.
SQL> select * from dba_tables order by 3,2,6,4,7,9,1,5;
select * from dba_tables order by 3,2,6,4,7,9,1,5
ERROR at line 1:
ORA-03212: Temporary Segment cannot be created in locally-managed tablespace
오라클 9i에서는 사용자별 default temporary tablespace가
어떤 TEMPORARY 타입이라도 무방하다.
=> TEMPORARY tablespace locally managed
=> tablespace TEMPORARY dictionary managed
PERMANENT locally-managed 타입의 테이블스페이스를 사용자의
TEMPORARY tablespace으로 지정할 때 다음과 같은 에러가 발생한다.
SQL> alter user x temporary tablespace PERM_LOCAL;
alter user x temporary tablespace PERM_LOCAL
ERROR at line 1:
ORA-12911: permanent tablespace cannot be temporary tablespace
2. TEMPORARY Tablespace/Tempfiles 대비 Tablespace TEMPORARY/Datafile
1) 공간관리
공간 관리는, locally managed tablespace에서 훨씬 단순하고, 또
효율적이기 때문에, TEMPORARY tablespace를 사용하는 것이
바람직하다. Local managedment 방식에서 사용 가능한 유일한
방식이 temporary tablespace 방식이다.
SQL> create tablespace temp1
2 DATAFILE '/ora/ora817/32/oradata/V817/temp1.dbf' size 100M
3 TEMPORARY
4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
create tablespace temp1
ERROR at line 1:
ORA-25144: invalid option for CREATE TABLESPACE with TEMPORARY contents
Dictionary-managed tablespace 대비 locally-managed tableapce의 장점은
<Bulletin No: 18261>에 자세히 기술되어 있다.
오라클 8i에서는, sort segment가 locally managed permanent tablespace에
생성될 수 없으므로, locally managed TEMPORARY tablespace를 사용하여야
한다.
Locally managed temporary tablespace는 tempfile을 사용하며, temporary
tablespace 바깥 데이터에 전혀 영향을 주지 않으면서, temporary tablespace
관련 데이터에 대한 redo정보가 생성되지 않는다.
이 테이블스페이스는, standby database나 read-only database에서도
사용 가능하다.
2) View
TEMPORARY tablespace 와 연관된 파일 목록은 V$TEMPFILE 과
DBA_TEMP_FILES 뷰를 통해 확인할 수 있다.
SQL> select * from dba_tablespaces;
TABLESPACE_NAME CONTENTS EXTENT_MAN
TEMP_TEMPFILE_LOCAL TEMPORARY LOCAL
TEMP_DATAFILE_DICT TEMPORARY DICTIONARY
SQL> select STATUS, ENABLED, NAME from v$tempfile;
STATUS ENABLED NAME
ONLINE READ WRITE /tcase/oradata/V901/temp_temp01.dbf
SQL> select FILE_NAME, TABLESPACE_NAME from dba_temp_files;
FILE_NAME TABLESPACE_NAME
/tcase/oradata/V901/temp_temp01.dbf TEMP_TEMPFILE_LOCAL
위 내용은 tablespace TEMPORARY 환경에서 V$DATAFILE 와
DBA_DATA_FILES를 사용하는 것에 비길 수 있다.
SQL> select STATUS, ENABLED, NAME from v$datafile;
STATUS ENABLED NAME
ONLINE READ WRITE /tcase/oradata/V901/temp_data01.dbf
SQL> select FILE_NAME, TABLESPACE_NAME from dba_data_files;
FILE_NAME TABLESPACE_NAME
/tcase/oradata/V901/temp_data01.dbf TEMP_DATAFILE_DICT
3) 권한
Temporary tablespace 또는 tablespace temporary 생성을 위해서는
CREATE TABLESPACE system privilege가 필요하다.
4) TEMPORARY Tablespace 생성
SQL> create TEMPORARY tablespace temp_tempfile_local
2 TEMPFILE '/ora/V817/temp_temp.dbf' size 100M
3 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
참고: 일부 OS에서는 tempfile block이 실제 액세스 되기
전 까지 tempfile이 실제로 생성되지 않는다. 이와 같은
파일 생성 작업이 지체되어 처리 되는 것은, tempfile의
생성과 크기 조정이 신속하게 처리되는데 도움이 된다.
그러나, tempfile이 나중에 생성되더라도, 생성 가능한
충분한 디스크 공간이 있어야 하겠다.
사용중인 O/S에서 tempfile이 실제 생성되는 시점은
플랫폼별 매뉴얼에 기술되어 있다.
Tablespace TEMPORARY의 생성
SQL> create tablespace TEMP_DATAFILE_DICT
2 datafile '/tcase/oradata/V901/temp_data.dbf' size 100M
3 TEMPORARY;
Tablespace created.
5) Tempfile/Datafile 제거
a. 테이블스페이스를 drop 하기 전까지 테이블스페이스의 datafile을
제거할 수 없다.
참고: 오라클 9i에서 DROP TABLESPACE 명령에 추가된
INCLUDING CONTENTS AND DATAFILES 절을 사용하면, OS로 부터
관련 데이터파일도 삭제하는 작업을 자동화 할 수 있다.
b. Temporary tablespace로 부터 tempfile을 삭제하고, 논리 구조를
비어 있는 상태로 유지할 수 있다.
=> 오라클 8i:
SQL> alter tablespace TEMP_TEMPFILE_LOCAL
2 add tempfile '/oradata/V817/temp_temp01.dbf';
Tablespace altered.
SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
2 drop;
Database altered.
SQL> !ls /oradata/V817/temp_temp01.dbf
/oradata/V817/temp_temp01.dbf
위 명령을 수행 한 후, tempfile을 시스템으로 부터 삭제하고,
나중에 다시 추가 시킬 수 있다.
SQL> alter tablespace TEMP_TEMPFILE_LOCAL
2 add tempfile '/oradata/V817/temp_temp01.dbf';
Tablespace altered.
=> 오라클 9i: OS 파일을 삭제 하기 위해 INCLUDING DATAFILES
절을 사용할 수 있다.
SQL> alter database tempfile '/oradata/V901/temp_temp01.dbf'
2 drop including datafiles;
Database altered.
SQL> !ls /oradata/V901/temp_temp01.dbf
/oradata/V901/temp_temp01.dbf not found
Temporary tablespace로 부터 모든 tempfile을 삭제하면,
다음과 같은 에러가 발생할 수 있다.
SQL> alter table olap.test add primary key (c);
alter table olap.test add primary key (c)
ERROR at line 1:
ORA-25153: Temporary Tablespace is Empty
ORA-25153
25153, 00000, "Temporary Tablespace is Empty"
// *Cause: An attempt was made to use space in a temporary tablespace with
// no files.
// *Action: Add files to the tablespace using ADD TEMPFILE command.
이 에러 메시지는 동시 작업 수행시 디스크를 실제 액세스 하여야
할 경우 발생하게 된다.
Example
Reference Documents
<Note:132663.1> ORA-03296 Resizing Temporary Locally Managed Tablespace
<Note:131769.1> ORA-03212 at Instance Startup
<Note:102339.1> Temporary Segments: What Happens When a Sort Occurs
<Note:160426.1> TEMPORARY Tablespaces : Tempfiles or Datafiles
Maybe you are looking for
-
MSI Afterburner no longer working in DayZ Standalone
Hello everyone, I have been using MSI to record my game play for some time and recently within the last couple months my MSI Afterburner has up and stopped recording in DayZ Standalone BUT it does work in every other game I have. So I was hoping s
-
Data merge CS5, will not create multiple records.
I have my base elements on the master page and two text boxes on page 1 on of a single page document. I am creating raffle tickets so there is box on the left side of the page and the right side of the page. I need this step 3 times down the sheet. I
-
How to I maintain a meter's scale position when resizing the meter?
I'd like to be able to programmatically resize a meter and have its scale's size and position be predicitable. This is not the case. I've attached a VI that illustrates the problem. I thought that keeping the meter's aspect ration of 4:3 would suffic
-
I created a disk image .iso using DeVeDe on a linux machine. Now I'm trying to burn that image to a dvd on my Mac computer using "Disk Utility". The .iso is 4.4GB, using a DVD-R that holds 4.7GB. It's saying the DVD isn't large enough to burn the fil
-
HELP Set render files location
Hi Guys, I'm new here, I'm a former FCP editor and I'm now on Pr 5.5. (and will be moving to CC soon) I have a question about setting up where my render files go as of right now they are save to my laptops hard drive and are eating up a lot of space