Resizing temporary tablespace in oracle 8i
Please,
I some questions on oracle 8i.
1. how do I know on oracle 8i if the tablespace X is the temporary tablespace?
2. I have someone that increase the size of the temporary tablespace, so I have to decrease it to its normal size, my question is when I do the following command.
alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 250M;
alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 250M
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
Does someone show me how to solve this issue?
Thanks
you can use the below sqls
sql>SELECT tablespace_name, extent_size, total_extents, used_extents,
free_extents, max_used_size FROM v$sort_segment;
From the output of the v$sort_segment query:
extent_size : size of one extent, in number of Oracle blocks
total_extents : total number of extents in the segment (free or in use)
used_extents : total number of extents currently in use
free_extents : total number of extents currently marked as free
max_used_size: maximum number of extents ever needed by an operation (like a sort):
sql> SELECT s.username, u.tablespace, u.contents, u.extents, u.blocks FROM v$session s,
v$sort_usage u WHERE s.saddr=u.session_addr;
SQL> select s.username, s.sid, u.tablespace, u.contents, u.segtype,
round(u.blocks*8192/1024/1024,2) MB
from v$session s, v$sort_usage u
where s.saddr = u.session_addr
and u.contents = 'TEMPORARY'
order by MB DESC ;
reference
### search MetaLink on: resize tempfile
Note 273276.1 How to Shrink the datafile of Temporary Tablespace
Note 274283.1 How to resize Tempfiles if receive an ORA-03297 error Gen RDBMS.
RD-9014 :
Note 132663.1 ORA-03296 Resizing Temporary Locally Managed Tablespace
Note 180578.1 Cannot Resize Tempfiles in Bitmapped Temporary Tablespaces
Note 161103.1 Space For a Tempfile Not Allocated In The Filesystem
Similar Messages
-
Temporary tablespaces in Oracle 10g
Hi,
I have created temporary tablespaces in Oracle 10g from the SQL prompt,but when i list the corresponding datafiles from v$datafile there tempfiles are not listed there,why is it so?
Regards,
CherryHi,
Take a look in
1 - DBA_TEMP_FILES :http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2398.htm
2 - V$TEMPFILE: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3225.htm
Cheers,
Marcello M. -
Temporary tablespace in oracle 8i
hi,
i am working in oracle 8.1.7.4.0.i am creating a temporary tablespace.
After creating the temp tablespace i am going to assign it as default temporary tablespace.
alter database default temporary tablespace <tbs-name>;
but its showing error...as
ora-02231 - missing or invalid option to alter database,
how to assign the default temporary tablespace in this oracle version.
Rgds...You can not set the temporary tablespace at the database level as default temporary tablespace in Oracle 8i. From Oracle 9i onwards, you can create and assign the temporary tablespace at the database level.
Only possible way in Oracle 8i is at the user level.
i.e.
SQL> alter user scott default tablespace TEMP;
HTH.
Regards,
Sabdar Syed. -
To resize temporary tablespace
The temporary tablespace extends endlessly and its size reaches 3.8 GB now. Every time the database startup, it takes a long time to initialize the temporary tablespace before completing startup process.
I want to resize it. What should I do next?
Should I add a limit to its size?
May experts here share your experience?
Thanks,
RichardTo all,
thank you for your opinions!
From the following SQL and its result, it can be noted that most space of the temporary segment is free.
select f.TABLESPACE_NAME, f.FILE_NAME, f.AUTOEXTENSIBLE, sum(s.BYTES)
from dba_free_space s, dba_data_files f
where s.FILE_ID = f.FILE_ID
group by f.TABLESPACE_NAME, f.FILE_NAME, f.AUTOEXTENSIBLE
DRSYS C:\ORACLE\ORADATA\HRDB01\DR01.DBF YES 87941120
INDX C:\ORACLE\ORADATA\HRDB01\INDX01.DBF YES 45735936
RBS C:\ORACLE\ORADATA\HRDB01\RBS01.DBF YES 503308288
SYSTEM C:\ORACLE\ORADATA\HRDB01\SYSTEM01.DBF YES 12632064
TEMP C:\ORACLE\ORADATA\HRDB01\TEMP01.DBF YES 3964395520
TOOLS C:\ORACLE\ORADATA\HRDB01\TOOLS01.DBF YES 12574720
USERS C:\ORACLE\ORADATA\HRDB01\USERS01.DBF YES 113238016
Then what should I do next? Drop the existing one and recreate a new temporary tablespace with a max size limit?
Richard -
Temporary tablespace/OS-Oracle DB/Redo change vector
At minimum, this tablespace should be as large as the
largest index that will be created, plus 10% for
overhead. Can anyone please throw more light on this . Why is this .Is this a hard and fast rule and left to the discretion of the DBA?
This is just a general question.How big of an impact can an operating system have on an oracle database . I mean with respect to everything . Performance/security etc. Unix vs Windows . I do know that on a Unix based system it will be more better to have oracle installed. But isn't there anything that can be done to have the same efffect in every aspect oracle for an database on a windows machine ?
Responses are appreciated!
A redo record consists of
1.redo record header
2.one or more change vectors
What is this change vector.This vwent over my head.Can anyone please elaborate on this.
null
nullWithin the limits of the Windows operating system, sure.
Realistically, most organizations use Unix for their large databases because
- when they made the decision about what operating system to use a decade (or more) ago, Windows was nowhere near enterprise ready
- given the human capital they have invested in Unix, there would be no point to moving to Windows
- there are many fewer high-quality Windows admins and Oracle DBAs with substantial Windows skills than Unix admins and Oracle DBAs with Unix experience
There is plenty that can be done to run a large Oracle database on a Windows machine successfully. Unfortunately, doing all these things tends to be harder on Windows, finding people knowledgable enough to do them properly tends to be hard, and relatively few organizations are invested enough in Windows to bother. That's changing over time, though-- there are a lot more Oracle databases on Windows today than there were 5 years ago.
Justin -
Hi,
How to view the temporary tablespace usage?
How to deallocate the used temporary tablespace segments/ resize temporary tablespace?
I am running a query which is consuming 4GB temporary tablespace and failing.
pga_aggregate_traget=500m;
oracle -9.2.0.1.0
OS:Windows 2003
How to solve this?
regards
MathewHi,
We are using the following View and it is fetchhing 46,56,00,000 rows.
PGA=500m
While running the query temporary tablespace is growing upto 4GB and query is failling.
CREATE OR REPLACE FORCE VIEW MHUBADMIN.LOAN_PIPELINE_VIEW
(LOAN_ID, USER_ID, FIRST_NAME, LAST_NAME, BORROWER_NAME,
SSN, USERNAME, SELLERLOANNUMBER, LOANNUMBER, LOANAMOUNT,
STATUS_DESC, LOAN_TYPE, LOCK_EXPIRE_DATE, ORG_NAME, ORG_PARENT_ID,
ORG_CHILD_ID, NO_CASCADE_FLAG, PRODUCT_NAME, INT_RATE, UPDATE_DATE,
UPDATE_DATE_STR, CURRENT_DATE, LOWER_FIRST_NAME, LOWER_LAST_NAME, LOWER_SSN,
LOWER_STATUS_DESC, STATUS_ID, AMORTIZATION_TYPE, STREET1, LOCK_EXTEN_EXPIR_DATE,
RELOCK_EXPIR_DATE, LOCK_RELOCK_COUNT, UNDERWRITE_FLAG, RECENT_EXPIR_DATE, STATUS_DATE)
AS
SELECT
LOAN.loan_id,
LOAN.user_id,
PERSON.first_name,
PERSON.last_name,
PERSON.last_name||', '||PERSON.first_name AS Borrower_Name,
PERSON.ssn,
HUBUSER.username,
LOAN.sellerloannumber,
LOAN.loannumber,
LOAN.loanamount,
STATUS.status_desc,
LOAN.loan_type,
PRICE.lock_expire_date,
ORGANIZATION.org_name,
BUSINESS_RELATIONSHIP.org_parent_id,
BUSINESS_RELATIONSHIP.org_child_id,
BUSINESS_RELATIONSHIP.no_cascade_flag,
product_name,
PRICE.final_rate,
LOAN.update_date,
TO_CHAR (LOAN.update_date,
'MM/DD/YYYY HH:MI:SS AM') update_date_str,
sysdate,
LOWER (PERSON.first_name),
LOWER (PERSON.last_name),
LOWER (PERSON.ssn),
LOWER (STATUS.status_desc),
STATUS.status_id,
LOAN.amortization_type,
ADDRESS.STREET1,
PRICE.LOCK_EXTEN_EXPIR_DATE,
PRICE.RELOCK_EXPIR_DATE,
LOAN.LOCK_RELOCK_COUNT,
LOAN.UNDERWRITE_FLAG,
decode (status.STATUS_ID,
22, PRICE.LOCK_EXTEN_EXPIR_DATE,
23, PRICE.lock_expire_date,
13, PRICE.lock_expire_date,
24, PRICE.RELOCK_EXPIR_DATE,
PRICE.lock_expire_date) RECENT_EXPIR_DATE,
LOAN_STATUS_HISTORY.STATUS_DATE
FROM
LOAN,
HUBUSER,
ORGANIZATION,
BUSINESS_RELATIONSHIP,
BORROWER,
PERSON,
STATUS,
PRICE,
product,
PROPERTY,
ADDRESS,
LOAN_STATUS_HISTORY
WHERE
ORGANIZATION.org_id = BUSINESS_RELATIONSHIP.org_child_id AND
LOAN.org_id = BUSINESS_RELATIONSHIP.org_child_id AND
LOAN.loan_id = BORROWER.loan_id AND
LOAN.registration_loan_status_id = STATUS.status_id AND
LOAN.price_id = PRICE.price_id AND
BORROWER.primaryborrower = 'T' AND
PERSON.person_id = BORROWER.person_id AND
LOAN.product_id = product.product_id AND
LOAN.PROPERTY_ID = PROPERTY.PROPERTY_ID AND
PROPERTY.ADDRESS_ID = ADDRESS.ADDRESS_ID AND
LOAN.user_id = HUBUSER.user_id (+);
Any one know how to tune this query?
regards
Mathew -
Hi,
I have a doubt regarding temporary tablespace. Oracle 9.2.0.5
When I create the default tablespace temp I see it growing and growing during some days until it reaches the maximum size and then it give the error ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
but monitoring the v$sort_segment I see one or 2 users logged and using the temp.
So my doubt is: what I have to do to find the BEST size for my temp tablespace. which queries is the recomended one to see the temp segments being used ?
Thank youSee http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/tspaces.htm#9566
To improve the concurrence of multiple sort operations, reduce their overhead, or avoid Oracle space management operations altogether, create temporary tablespaces. A temporary tablespace can be shared by multiple users and can be assigned to users with the CREATE USER statement when you create users in the database.
Within a temporary tablespace, all sort operations for a given instance and tablespace share a single sort segment. Sort segments exist for every instance that performs sort operations within a given tablespace. The sort segment is created by the first statement that uses a temporary tablespace for sorting, after startup, and is released only at shutdown. An extent cannot be shared by multiple transactions.
You can view the allocation and deallocation of space in a temporary tablespace sort segment using the V$SORT_SEGMENT view. The V$TEMPSEG_USAGE view identifies the current sort users in those segments. -
Default temporary tablespace in 8i
Hi
is it possible to change the default temporary tablespace in oracle 8.1.6
SQL> Create temporary tablespace temp1 tempifle '/oradata/temp01' size 2000m;
SQ>alter database default temporary tablespace temp1; this shows invalid option for alter databaseAs far as I remember, there wasn't a default temporarary tablespace at the database level before 9i.
You need to define it at the user level.
Nicolas. -
Queries about Space Info of Temporary Tablespace
Hi
I want to know the free space, used space, total space of Temporary Tablespace,
and also how much space is currently using by different active sessions of Temporary Tablespace.
Oracle version is 9.2.0.1.0
Can any body send the links or queries regarding this.
Thanks,This link might help http://www.orafaq.com/faqdba.htm#TEMPSPACE
-
Temporary tablespace resizing in physical standby
Hi all,
We have a oracle 9.2.0.6 on Sun soalris.IN Our standby db we are facing one problem is related to temporary tablespaces.
ORA-1652: unable to extend temp segment by 128 in tablespace TEMPso how to resize the datafile we are already having a two dafiles realted to temp tablespaces
Edited by: user00726 on Jun 2, 2009 10:25 PMHi Kamran and Anand,
Both the command s are working
ALTER DATABASE ADD TEMPFILE 'tempfile_name.dbf' SIZE 5GByesterday only i have added one of the datafile on the same standby database
Wed Jun 3 01:33:53 2009
ORA-1652: unable to extend temp segment by 128 in tablespace TEM
P
Wed Jun 3 01:33:54 2009
ORA-1652: unable to extend temp segment by 128 in tablespace TEM
P
Wed Jun 3 11:23:15 2009
ALTER DATABASE TEMPFILE '/bkp/oradata1/temp02.dbf' resize 4024 M
Wed Jun 3 11:24:00 2009
Completed: ALTER DATABASE TEMPFILE '/bkp/oradata1/temp02.dbf'
Wed Jun 3 12:53:26 2009
ORA-1652: unable to extend temp segment by 128 in tablespace TEM
P
Wed Jun 3 12:53:26 2009
ORA-1652: unable to extend temp segment by 128 in tablespace TEMand
today also i have resized the temp files
ALTER DATABASE TEMPFILE 'tempfile_name.dbf' RESIZE 5GB -
Oracle 8.0 - how to identify temporary tablespace using dba v$ views
Hello experts,
can someone tell me how can I query a v$ or dba_ view to identify which are the temporary tablespace in a 8.0.5 Oracle database?
Thx in advance.8.0 did not have the concept of tempfiles.
However, a Tablespace could be created as a Temporary tablespace (still using "normal" datafiles) with CREATE/ALTER TABLESPACE tablespacename TEMPORAR.
Meaning : You can't query DBA_TEMP_FILES or V$TEMPFILEs. You have to query DBA_USERS to identify the designated Temporary Tablespace(s) and then query DBA_TABLESPACES for the storage parameters and then query DBA_DATA_FILES for the files.
You can also query DBA_TABLESPACES for CONTENTS='TEMPORARY' and then query DBA_DATA_FILES.
Hemant K Chitale -
Temporary tablespace Oracle 8i
Hi,
We are having oracle 8i database on windows OS.
Now, the existing TEMP TS in our database is dictionary managed.
So, can i drop the existing TEMP TS and create a new one with locally managed ?
if i create new TEMP TS (locally managed) then, should i keep temp datafiles autoextend ON or OFF ? which is advisable ?
doing so, will it help in improving the performance of the database upto some level ?
With regardsHi,
I have dropped the exiting TEMP (dictionary managed) TS but getting error when i am trying to create a new one .i.e. locally managed
Storage parameters of existing TEMP TS (dictionary) that i dropped :-
CREATE TABLESPACE TEMP DATAFILE
'D:\ORACLE\ORADATA\EITXIS\TEMP01.DBF' SIZE 8388800K AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED,
'D:\ORACLE\ORADATA\EITXIS\TEMP02.DBF' SIZE 500M AUTOEXTEND OFF
MINIMUM EXTENT 64K
LOGGING
DEFAULT STORAGE (
INITIAL 64K
NEXT 64K
MINEXTENTS 1
PCTINCREASE 0
ONLINE
TEMPORARY
EXTENT MANAGEMENT DICTIONARY;
Storage parameters of TEMP TS (locally) that i am trying to create :-
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE
'D:\ORACLE\ORADATA\EITXIS\temp01.dbf' SIZE 1024M AUTOEXTEND ON NEXT 1M,
'D:\ORACLE\ORADATA\EITXIS\temp02.dbf' SIZE 1024M AUTOEXTEND OFF
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
But when i am trying to create the new TEMP TS (locally managed) i get the below error :-
ORA-03214: File Size specified is smaller than minimum requrired
where i have done mistake ?
Its ok now ...... TEMP TS created with locally managed, but does new storage parameters for TEMP TS (locally), mentioned above are proper now ?
With Regards
Edited by: user640001 on May 11, 2009 1:02 AM -
How to check temporary tablespace size in Oracle 7?
Hi,
Anyone still using Oracle 7 ? I would like to know the sql to check the temporary tablespace and its datafile size.
Thank,
Regards,
Eye Geehttp://www.oracle.com/technetwork/documentation/oracle7-091910.html
-
Shrinking a Locally Managed Temporary Tablespace
So, even thoguh the documentation is pretty clear about how to use this feature, I cannot get it to do what I expect it to do for me.
And that would be shrinking the tempfile ;)
Now lets face it, I have a large tempfile and want to resize it without restarting the database:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Di Nov 20 05:49:59 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
SQL> select file_name
, ceil(bytes / 1024 / 1024) "size MB"
from dba_temp_files
FILE_NAME size MB
R:\MXVC01\TEMP01.DBF 31,231
SQL> select su.username
, ses.sid
, ses.serial#
, su.tablespace
, ceil((su.blocks * dt.block_size) / 1048576) MB
from v$sort_usage su
, dba_tablespaces dt
, v$session ses
where su.tablespace = dt.tablespace_name
and su.session_addr = ses.saddr
USERNAME SID SERIAL# TABLESPACE MB
VPXADMIN 15 15 TEMP 14
VPXADMIN 17 5 TEMP 1,203
VPXADMIN 17 5 TEMP 1
VPXADMIN 18 3 TEMP 7
VPXADMIN 19 3 TEMP 1
VPXADMIN 144 3 TEMP 1
VUMADMIN 156 2597 TEMP 1
7 rows selected.
Or this one:
SQL> select tablespace_size/1024/1024 "tablespace_size mb"
, allocated_space/1024/1024 "allocated_space mb"
, free_space/1024/1024 "free_space mb"
from dba_temp_free_space
tablespace_size mb allocated_space mb free_space mb
31230,9922 1228,99219 30002
Documetation from here: http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces007.htm#ADMIN12353
+"Shrinking a Locally Managed Temporary Tablespace+
+Large sort operations performed by the database may result in a temporary tablespace growing and occupying a considerable amount of disk space. After the sort operation completes, the extra space is not released; it is just marked as free and available for reuse. Therefore, a single large sort operation might result in a large amount of allocated temporary space that remains unused after the sort operation is complete. For this reason, the database enables you to shrink locally managed temporary tablespaces and release unused space.+
+You use the SHRINK SPACE clause of the ALTER TABLESPACE statement to shrink a temporary tablespace, or the SHRINK TEMPFILE clause of the ALTER TABLESPACE statement to shrink a specific tempfile of a temporary tablespace. Shrinking frees as much space as possible while maintaining the other attributes of the tablespace or tempfile. The optional KEEP clause defines a minimum size for the tablespace or tempfile.+
+Shrinking is an online operation, which means that user sessions can continue to allocate sort extents if needed, and already-running queries are not affected.+
+The following example shrinks the locally managed temporary tablespace lmtmp1 to a size of 20M.+
+ALTER TABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;+
+The following example shrinks the tempfile lmtemp02.dbf of the locally managed temporary tablespace lmtmp2. Because the KEEP clause is omitted, the database attempts to shrink the tempfile to the minimum possible size.+
+ALTER TABLESPACE lmtemp2 SHRINK TEMPFILE '/u02/oracle/data/lmtemp02.dbf';"+
OK, lets do it:
SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
It seems there is a bug? Should I report it, or is it the expected behaviour?
Now lets try this one:
SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF' keep 2048M;
Tablespace altered.
SQL> select file_name
, ceil(bytes / 1024 / 1024) "size MB"
from dba_temp_files
FILE_NAME size MB
R:\MXVC01\TEMP01.DBF 31,231
So .... this lasts about *10 minutes*, and nothing changes?
It seems there is a bug? Should I report it, or is it the expected behaviour?
Could someone enlighten me, what this SHRINK is actually doing?
Is it worth to report this as bug, if not a software bug it is at least a documentation bug because it doesn't mention under which conditions it is working?
P.S.: OMG the posting looks terrible, who's the one to blame for this forum software where it is not possible to use fixed size fonts, or format paragraphs as code, or what about the fact that the forum software is using default SQLPlus output as META for some graphical lines?
Isn't this the forum for Oracle Database users?
Edited by: Gerrit Haase on 20.11.2012 13:44So, you are kidding with me? No? Who are you?
How can I block users here? Is there a moderator present at this forum?
Maybe you read my initial post again?
I didn't look at the wrong place.
I reported you for general abuse.
SQL> define
DEFINE _DATE = "20.11.12" (CHAR)
DEFINE CONNECTIDENTIFIER = "MXVC01" (CHAR)
DEFINE _USER = "SYS" (CHAR)
DEFINE _PRIVILEGE = "AS SYSDBA" (CHAR)
DEFINE SQLPLUSRELEASE = "1102000200" (CHAR)
DEFINE _EDITOR = "Notepad" (CHAR)
DEFINE OVERSION = "Oracle Database 11g Release 11.2.0.2.0 - 64bit Production" (CHAR)
DEFINE ORELEASE = "1102000200" (CHAR)
SQL> SELECT * FROM dba_temp_free_space;
TABLESPACE_NAME TABLESPACE_SIZE ALLOCATED_SPACE FREE_SPACE
TEMP 3,2748E+10 1306517504 3,1443E+10
SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
31230,9922 1245,99219 29986
SQL> ALTER TABLESPACE temp SHRINK SPACE;
Tablespace altered.
SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
31230,9922 1244,99219 *29986*
R:\mxvc01>dir temp
Volume in drive R is Disk_R
Volume Serial Number is 248B-61D4
Directory of R:\mxvc01
20.11.2012 08:09 32.748.077.056 TEMP01.DBF
1 File(s) 32.748.077.056 bytes
0 Dir(s) 8.259.297.280 bytes free
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
*It clearly says that there is 29986 MB Space FREE and the above shrink space changes nothing and so does shrink tempfile:*
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF' KEEP 20M;
Tablespace altered.
R:\mxvc01>dir temp
Volume in drive R is Disk_R
Volume Serial Number is 248B-61D4
Directory of R:\mxvc01
20.11.2012 08:24 32.748.077.056 TEMP01.DBF
1 File(s) 32.748.077.056 bytes
0 Dir(s) 8.259.280.896 bytes free
*... nothing changes, the tempfile isn't smaller now ...* -
Move tables (some with LONG datatypes) across tablespaces in Oracle 9i
I have a 14GB tablespace which about 3,000 tables (and only tables) in. Only 2.6GB is used so I would like to resize the tablespace to about 3GB initially.
I moved the tables with "alter table <owner>.<tablename> move tablespace <tablespace>" and this worked for most of the tables but failed on some with this kind of error:
alter table IFSAPP.COMMAND_SYS_BUFFER_TAB move tablespace IFSAPP_DATA_TEMP
ERROR at line 1:
ORA-00997: illegal use of LONG datatypeI then moved the other tables back to the original a little frustrated.
Further reading suggested exporting and importing the tables is the way to go.
I prefer the alter table because Oracle manages the lock whilst it moves. If I export and import, the table could change in between, potentially ending with me importing an old copy, couldn't it? [It seems neigh on impossible to guarantee an available window to do much!]
So I though I could you the alter table move for ALL tables and those that are left, use export/import, to minimise the risk.
How should I proceed?
1) Create TEMP_TABLESPACE as 3GB
2) "alter table ... move tablespace ..." for all tables in ORIGINAL_TABLESPACE to TEMP_TABLESPACE
3) For the remaining tables, individually:
a) lock table (not sure how)
b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
c) drop table
d) create table in TEMP_TABLESPACE*
e) import table: imp user/pass tables=tablename
* this means I need to know how to re-create the table. It also means views and indexes and packages are going to become invalid.
4) drop tablespace ORIGINAL_TABLESPACE
5) Create ORIGINAL_TABLESPACE as 3GB
6) "alter table ... move tablespace ..." for all tables in TEMP_TABLESPACE to ORIGINAL_TABLESPACE
7) For the remaining tables, individually:
a) lock table (not sure how)
b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
c) drop table
d) create table in ORIGINAL_TABLESPACE
e) import table: imp user/pass tables=tablename
This seems high risk and messy.
Has anyone advice or tips to make it simpler?
As it stands I am considering leaving alone, the risks worry me!
ThanksInteresting idea.. so this would create a temporary table in the temporary tablespace.
Rather than set the default tablespace, can I merely add the tablespace clause?
COPY FROM user/password@database CREATE TmpTblName TABLESPACE TmpTablespace USING SELECT
* FROM Table_name;
Either way - can you confirm for each table, I would need to:
COPY FROM user/password@database CREATE TmpTblName TABLESPACE temp_tablespace USING SELECT * FROM Table_name;
At this point all indexes for these will be invalid.
Drop tablespace ORIGINAL_TABLESPACE
Create ORIGINAL_TABLESPACE as 3GB
COPY FROM user/password@database CREATE TblName TABLESPACE original_tablespace USING SELECT * FROM TmpTable_name;
rebuild any indexes which are unusable.
recompile any invalid objects
Maybe you are looking for
-
Hi all! I was updating the software on i pad to ios6, update was interrupted(apple update server is unavailable...). iTunes Diagnostics shows that "secure link to I tunes store failed". I use Windows 7 Home Premium 64 bit. Can anybody help please? Th
-
Sending Smart forms O/P as an attachment thru e-mail...
Hi friends... I have dveloped a new Smartform for PO reminder letter.. and I am trying to send it as an attachment thru mail... the code I wrote for that is given... but I am getting a runtime error like In program "CL_TRACE_BCS==================CP "
-
I need help !!!! I have an java Applet that call web services.That applet has a button wich when is pressed it send a request to the SOAP server.The request is an asynchron call because we are invocating a web service wich will return some results. W
-
SBO-Common error when Using oRecordSet = oCompany.GetCompanyList
Good Day Experts: I am having a bit of trouble running the code in the COM DI\05.OrderAndInvoice sample. On the line --> oRecordSet = oCompany.GetCompanyList An error appears "Connection to SBO-Common has failed". I would like to do the same thing
-
Hi board. Since I upgraded to emac-23.1, the thing is very slow. Example: I have a orgmode file opened, with several long sections (hundreds lines each) collapsed. When I move from one line to another (thus skipping several hundred lines), there is a