Script for temporary tablespace in 8.1.7.4.0

Hi,
I am working in oracle 8.1.7.4.0 and HP-UX os.I need a shell script which is to do the following tasks,
1. create a new temporary tablespace
2.assign the new temp tablespace to the database user level
3.drop the old temp tablespace
4. then create a temp tablespace with the old name
5. then assign the new temp tablespace to the database user level
6.drop the new temp tablespace
Kindly provide me the script for oracle 8.1.7.4.0
Rgds..

here is one I prepared earlier (just like a TV chef)
set echo on
-- Create a New TEMP TEMP
create temporary tablespace temp2
tempfile 'dir/temp2.dbf' size 5M
autoextend on next 1M maxsize unlimited extent management local uniform size 1M;
-- Make the TEMP2 tablespace temp
alter database default temporary tablespace temp2;
-- Drop the orginal to recreate with new size
drop tablespace temp including contents and datafiles;
CREATE TEMPORARY TABLESPACE TEMP
TEMPFILE 'dir/temp01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 30000M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M;
alter database default temporary tablespace temp;
drop tablespace temp2 including contents and datafiles;

Similar Messages

  • INCLUDED_IN_DATABASE_BACKUP for temporary tablespace

    Hi,
    The query output from v$tablespace shows the INCLUDED_IN_DATABASE_BACKUP value for temp tablespace in my db is "YES". The only way to have the value "NO" is to configure rman to exclude tbs. But you can not exclude temporary tablespace. Based on the size of total full backup files, the temp tablespace does not seem to be backup by rman. Is this a bug or is there other way to set this value for temporary tablespace to "NO"? I'm using 9iR2. Thanks.

    >...The only way to have the value "NO" is to configure rman to exclude tbs. But you can not exclude temporary tablespace.
    RMAN doesn't include the temporary tablespace in the backups.
    SQL> select * from v$tablespace;
           TS# NAME                           INC
             0 SYSTEM                         YES
             7 TEST                           YES
             3 USERS                          YES
            4 TEMP YES
             6 UNDO                           YES
    RMAN> list backup of tablespace TEMP;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of list command at 01/26/2006 20:04:06
    RMAN-06004: ORACLE error from recovery catalog database: RMAN-20202: tablespace not found in the recovery catalog
    RMAN-06019: could not translate tablespace name "TEMP"
    RMAN> list backup of tablespace UNDO summary;
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time #Pieces #Copies Tag
    3125    B  0  A DISK        22-JUL-05       1       1       TAG20050722T102731
    3207    B  0  A DISK        24-OCT-05       1       1       TAG20051024T163622
    3248    B  1  A DISK        02-NOV-05       1       1       TAG20051102T225318
    3360    B  F  A DISK        23-JAN-06       1       1       TAG20060123T172135Aron

  • TEMP datafiles for temporary tablespaces don't have same timestamp

    Hi,
    This is what I have done:
    Installing 10G2 on XP PRO with sample database.
    Tried to install Designer Repository with the Wizard, created a user for the toolkit, that failed.
    Added 1 temp tablespace size 20Meg from OEM console.
    Dropped cascade Toolkit schema owner and recreated it
    Tried to install Designer Repository, that failed again
    Added 1 temp tablespace size 1giga from OEM console, failed again to import
    Dropped cascade Toolkit schema owner and recreated it
    Tried to install Designer Repository, that failed again
    Gave up for now: I have located a doc about installing manually by running scripts, will do as soon as I feel at ease with OEM.
    Then I put the PC on snooze while database was up, crashed it.
    Stopped the services, checked the logs, restarted manually and slowly, base up.
    Now both extra TEMP datafiles are lagging behind, seen from Windows explorer, but the tablespaces are seen as online from oem, not seen from sqlplus dba_tablespaces view.
    So the question is:
    Are the TEMP datafiles supposed to stay in sync with the others or is it ok if they show timestamps dating three days back, provided there has not been any users transactions in the database?
    I checked the 10G2 DBA online doc, but I can't find where it's mentioned.
    Many thanks if you can help.

    Hi,
    Everything allright, they do show!
    I'm a bit wary about resizing anything, maybe you remember the resizing bug for SYSTEM tablespace in version 7?
    I have to beef up on DBA tricks.
    Since I also have a 1 Giga Users tablespace, I'll do some heavy Inserting and Updating and Sorting see if that tickles the Temps.
    Many thanks for your prompt reply.
    Message was edited by:
    JeanParis

  • Drop a temporary tablespace

    Hi all
    I have created a temporary tablespace temp01 and assign it as the default temporary tablespace for the database (10.0.2.0)
    How can I drop it without changing the default temporary tablespace?
    thanks for help

    phaeus wrote:
    Hello,
    create a new temporary tablespace. Make it to your default database temp tablespace and then you can drop the old one.
    A couple of thoughts I'd want to check on that - based on memories of problems in the dim and distant past.
    If you take this approach, do you still have to worry about users who have already got the dropped tablespace associated with their temp tablespace in dba_users ? Memory says they'll either get an error message, or they'll fall back to SYSTEM despite there being a new default.
    One of the reasons for creating tablespace groups for temporary tablespaces is that you can assign a tablespace group to a user, and then invisibly create and drop temporary tablespaces in that group without having to adjust the users' details. But there used to be a bug that resulted in excessive hits on dc_tablespaces if you did this, and extreme numbers of executions of a query against ts$ (or maybe file$).
    Regards
    Jonathan Lewis

  • Bigfile Temporary Tablespaces

    In most RAC environments, you use multiple tempfiles in a temp tablespace to avoid contention yet in the Exadata OLTP best practices guide it stats that you should start out by using a bigfile tablespace for temporarty tablespaces. This seemed odd to me since bigfile tablespaces can only have one tempfile. Understanding that OLTP may not have much parallelism, so multiple tempfiles may not be needed but it still seemed odd to use bigfile instead of smallfile tablespaces for something like temp. Does anyone have any experience with using bigfile tablespaces on RAC for temporary tablespaces.

    I have used bigfile temporary tablespaces for some intensively parallelized operations and never encountered any contention problems. If I were you, since we are talking about temporary stuff, I would make the change and run some tests.

  • Amount of temporary tablespace size used for index rebuild

    Hi All,
    I want to know approximate amount of temporary tablespace size used for index rebuild. I need this information to avoid the insufficient temporary tablespace error during the huge index rebuild.
    Is there a query or procedure to find it out.
    Thank you.

    Hi,
    While creating the index, the temporary segment is created in the permanent tablespace. So permanent tablespace must have sufficient space.
    http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php
    http://aprakash.wordpress.com/2010/01/05/numeric-segment-name/
    Anand

  • Using temporary tablespace for sort in select statement without spacifying

    how can i use some particular temporary tablespace in select statement for sording without allocating any temporary tablespace to that user

    Try to set for the current session the in memory sorting space to 0 before running your query:
    SQL> alter session set sort_area_size = 0;The query should use the temporary tablespace.
    Message was edited by:
    Pierre Forstmann

  • How big for the temporary tablespace is proper?

    Hi,
    I get the error several times per month:
    ORA-1652: unable to extend temp segment by 256 in tablespace temp
    The size of this temporary tablespace is 1G. Of couse I can inrease to 2G or 10G.
    questions:
    How to determine the new size for this tablespace properly?
    what factors will be considered for it?
    Thanks

    I think more than one 1GB for a 6GB is acceptable. I agree the temp size is not determied by database size, but satistically it should be in a range compared with database size, right?
    Well, what I did in this situation is to create a scheduled job, get information from v$sort_usage and kepp it in a table. This job run in every 5 mins. I let it run a couple of days, then I can know which SQL consumes too much temp space. After that, I tune this SQL to resolve the issue. Hopefully it would be help to you.

  • ORA-03217: invalid option for alter of TEMPORARY TABLESPACE

    Hi all
    I have a database with 300 Users approximantely.
    Suddenly I was reported about slowly connection and looked to my database. And I saw that Temporary tablespace with name MUVTEMP is 0% used and in it there is no .dbf file
    Then I do ls on my data files directory and saw there MUVTEMP01.dbf!
    But it's not using it. Then I want to add another .dbf file. It created this file physically but not joined it to my temporary tablespace.
    Then I did it with Oracle EM, clicked on "Show SQL" and there was written
    ALTER TABLESPACE "MUVTEMP"
    ADD
    DATAFILE '/home/oracle/OraHome1/oradata/linux/test.dbf' SIZE
    5M
    I run it from EM it gave this error
    ORA-03217: invalid option for alter of TEMPORARY TABLESPACE
    Then I run this SQL in sqlplus
    ALTER TABLESPACE "MUVTEMP"
    ADD
    TEMPFILE '/home/oracle/OraHome1/oradata/linux/test.dbf' SIZE
    5M
    it created file physically, but I can't see this file as temporary tablespace's file. It's not using....
    Where is my mistake???
    Thanks...

    Hi,
    try this query:
    select s.sid || ',' || s.serial# sid, s.username, u.tablespace, substr(a.sql_text, 1, (instr(a.sql_text, ' ')-1)) sql_text,
      round(((u.blocks*p.value)/1024/1024),2) size_mb
    from v$sort_usage u, v$session s, v$sqlarea a, v$parameter p
    where s.saddr = u.session_addr
      and a.address (+) = s.sql_address
      and a.hash_value (+) = s.sql_hash_value
      and p.name = 'db_block_size'
    group by s.sid || ',' || s.serial#, s.username, substr(a.sql_text, 1, (instr(a.sql_text, ' ')-1)), u.tablespace, round(((u.blocks*p.value)/1024/1024),2);

  • DEFAULT TABLESPACE and TEMPORARY TABLESPACE for eBusiness Suite database

    Hi:
    What is the
    DEFAULT TABLESPACE and TEMPORARY TABLESPACE
    for eBusiness Suite database.
    I want to create a new schema on the eBusiness Suite database.
    Please help

    DEFAULT TABLESPACE and TEMPORARY TABLESPACE
    for eBusiness Suite database.
    I want to create a new schema on the eBusiness Suite database.Create a new tablespace and temporary tablespace for your custom schema (you may use the existing temporary tablespace).
    Integrating Custom Applications with Oracle Applications Release 11i [ID 176852.1]
    Step By Step Guide to Creating a Custom Application in Applications 11i [ID 216589.1]
    Thanks,
    Hussein

  • Change temporary tablespace for session

    hi.
    i wonder if it's possible to change temporary tablespace for session in the way other then `alter user <user> temporary tablespace <tbc>'?

    Hi,
    Temporary tablespace is set at database level and user level. It is not set at the session level.
    The below is an extract from Oracle Docs for 10gR2
    The DEFAULT TEMPORARY TABLESPACE clause of the CREATE DATABASE statement
    creates a default temporary tablespace for the database. Oracle Database assigns this
    tablespace as the temporary tablespace for users who are not explicitly assigned a
    temporary tablespace.
    You can explicitly assign a temporary tablespace or tablespace group to a user in the
    CREATE USER statement. However, if you do not do so, and if no default temporary
    tablespace has been specified for the database, then by default these users are assigned
    the SYSTEM tablespace as their temporary tablespace.You can specifically assign a temporary tablespace for the user but not for the session.
    regards,
    Vijayaraghavan K

  • Can i change the temporary tablespace for schemas during the transactions??

    In My Prod database some of the tablespaces assigned system as Temporary tablespace. I want to change the temporary tablespace for these schemas and the default temporary tablespace of the database.
    Can I make this change while the users are accessing the database. Is there any impact If i make this change while the transactions are running.
    Below is the change i want to do........
    1. Change the users for SYSTEM to TEMP in the temporary tablespace by executing the following SQL
    statements:
    alter user SYSTEM temporary tablespace TEMP;
    alter user SYS temporary tablespace TEMP;
    alter user AD_MONITOR temporary tablespace TEMP;
    alter use SI_INFORMTN_SCHEMA temporary tablespace TEMP;
    alter user EM_MONITOR temporary tablespace TEMP;
    alter user ORDPLUGINS temporary tablespace TEMP;
    alter user TSMSYS temporary tablespace TEMP;
    alter user XDB     temporary tablespace TEMP;
    alter user SCOTT temporary tablespace TEMP;
    alter user DBSNMP temporary tablespace TEMP;
    alter user DIP     temporary tablespace TEMP;
    alter user OUTLN temporary tablespace TEMP;
    alter user ANONYMOUS temporary tablespace TEMP;
    alter user ORDSYS temporary tablespace TEMP;
    alter user MDDATA temporary tablespace TEMP;
    2. Set the default temporary tablespace to TEMP by executing the following SQL statement:
    alter DATABASE default temporary tablespace TEMP;

    user11829256 wrote:
    But if one transaction is using the old temporary tablespace and if i change the temporary tablespace of user will that transactions of that user fails which is using the old temp segment....It will continue to use the old one till the end of transaction.
    Here a quick test (hopefully readable) :
    -- session 1 as a dba user
    SQL> grant create session to nga identified by nga;
    Grant succeeded.
    SQL> alter user nga temporary tablespace tmp;
    User altered.
    SQL> select temporary_tablespace from dba_users where username='NGA';
    TEMPORARY_TABLESPACE
    TMP
    -- session 2 as NGA
    SQL> insert into gtt
      2  select * from (select * from all_objects union all select * from all_objects union all select * from all_objects);
    80559 rows created.
    -- session 1 as a dba user
    SQL> select tablespace from v$tempseg_usage where username='NGA';
    TABLESPACE
    TMP
    SQL> alter user nga temporary tablespace pstemp;
    User altered.
    SQL> select tablespace from v$tempseg_usage where username='NGA';
    TABLESPACE
    TMP
    SQL> select temporary_tablespace from dba_users where username='NGA';
    TEMPORARY_TABLESPACE
    PSTEMP
    -- session 2 as NGA
    80559 rows created.
    SQL> roll;
    Rollback complete.
    -- session 1 as a dba user
    SQL> select tablespace from v$tempseg_usage where username='NGA';
    no rows selected
    -- session 2 as NGA
    SQL> insert into gtt
      2  select * from (select * from all_objects union all select * from all_objects union all select * from all_objects);
    80559 rows created.
    -- session 1 as a dba user
    SQL> select tablespace from v$tempseg_usage where username='NGA';
    TABLESPACE
    PSTEMPNicolas.

  • Where to dowload table script for demo table EMPLOYEE

    Hello!
    I'm reading the book "Oracle PL/SQL Programming, Fourth Edition"
    By Steven Feuerstein.
    And I can't find the script for the employee table ..
    Where can I get it?
    Regards
    Tobias

    Copy this script in notepad and then save in .sql format and then run
    rem
    rem Header: hr_main.sql 09-jan-01
    rem
    rem Copyright (c) 2001, Oracle Corporation. All rights reserved.
    rem
    rem Owner : ahunold
    rem
    rem NAME
    rem hr_main.sql - Main script for HR schema
    rem
    rem DESCRIPTON
    rem HR (Human Resources) is the smallest and most simple one
    rem of the Sample Schemas
    rem
    rem NOTES
    rem Run as SYS or SYSTEM
    rem
    rem MODIFIED (MM/DD/YY)
    rem ahunold 08/28/01 - roles
    rem ahunold 07/13/01 - NLS Territory
    rem ahunold 04/13/01 - parameter 5, notes, spool
    rem ahunold 03/29/01 - spool
    rem ahunold 03/12/01 - prompts
    rem ahunold 03/07/01 - hr_analz.sql
    rem ahunold 03/03/01 - HR simplification, REGIONS table
    rem ngreenbe 06/01/00 - created
    SET ECHO OFF
    PROMPT
    PROMPT specify password for HR as parameter 1:
    DEFINE pass = &1
    PROMPT
    PROMPT specify default tablespeace for HR as parameter 2:
    DEFINE tbs = &2
    PROMPT
    PROMPT specify temporary tablespace for HR as parameter 3:
    DEFINE ttbs = &3
    PROMPT
    PROMPT specify password for SYS as parameter 4:
    DEFINE pass_sys = &4
    PROMPT
    PROMPT specify log path as parameter 5:
    DEFINE log_path = &5
    PROMPT
    -- The first dot in the spool command below is
    -- the SQL*Plus concatenation character
    DEFINE spool_file = &log_path.hr_main.log
    SPOOL &spool_file
    REM =======================================================
    REM cleanup section
    REM =======================================================
    DROP USER hr CASCADE;
    REM =======================================================
    REM create user
    REM three separate commands, so the create user command
    REM will succeed regardless of the existence of the
    REM DEMO and TEMP tablespaces
    REM =======================================================
    CREATE USER hr IDENTIFIED BY &pass;
    ALTER USER hr DEFAULT TABLESPACE &tbs
    QUOTA UNLIMITED ON &tbs;
    ALTER USER hr TEMPORARY TABLESPACE &ttbs;
    GRANT CONNECT TO hr;
    GRANT RESOURCE TO hr;
    REM =======================================================
    REM grants from sys schema
    REM =======================================================
    CONNECT sys/&pass_sys AS SYSDBA;
    GRANT execute ON sys.dbms_stats TO hr;
    REM =======================================================
    REM create hr schema objects
    REM =======================================================
    CONNECT hr/&pass
    ALTER SESSION SET NLS_LANGUAGE=American;
    ALTER SESSION SET NLS_TERRITORY=America;
    -- create tables, sequences and constraint
    @?/demo/schema/human_resources/hr_cre
    -- populate tables
    @?/demo/schema/human_resources/hr_popul
    -- create indexes
    @?/demo/schema/human_resources/hr_idx
    -- create procedural objects
    @?/demo/schema/human_resources/hr_code
    -- add comments to tables and columns
    @?/demo/schema/human_resources/hr_comnt
    -- gather schema statistics
    @?/demo/schema/human_resources/hr_analz
    spool off

  • Temporary tablespace questions

    I have an Oracle 9.2.0.1.0 database running on a Windows 2000 server. I'm encountering several problems with its temporary tablespace. Here is how the temporary tablespace is created:
    create database testdb
    datafile 'd:\oradb\testdb\datafiles\testdbsys1.dbf'
    size 200M AUTOEXTEND ON NEXT 10M
    default temporary tablespace temporary
    tempfile 'd:\oradb\testdb\datafiles\tmp1.dbf'
    size 16400K reuse autoextend on next 16400K
    undo tablespace undotbs
    datafile 'd:\oradb\testdb\datafiles\testdbrbs1.dbf'
    size 100M reuse autoextend on next 10M maxsize unlimited;
    Questions:
    1- Despite the fact that the temporary tablespace datafile is specified "autoextend on", it autoextends up to 4 Gb then it fails. The exact error is ORA-0652: unable to extend temp segment by 64 in tablespace TEMPORARY. If I manually extend it beyond 4 Gb, everything works fine. Is this a bug or is it something I do wrong ? If so, what should I do to correct this ?
    2- I can't figure out what statement of my application makes the temporary tablespace grow so big. I looked at all the trace files in UDUMP and I noticed it's always the same statement that is logged when the "autoextend" error occurs. But when I run the statement on its own in SQLPlus, nothing special happens to the temporary tablespace. What is the best way to track what statement uses what resources of the temporary tablespace ?
    3- I don't know if this is what happens, but it looks like space isn't reused in the temporary tablespace. Is this possible ? If so, how can I tell Oracle to reuse it ?
    Thanks.

    1-You can try to modify the maxsize for datafaile to UNLIMITED. I am not sure it shall work, but it's worth a try
    2-Probably it's a statement that uses an order by on a large result set
    3-You can try to force the wakeup of SMON process that would free the unused extents of temporary tablespace.
    Try http://www.ixora.com.au/tips/admin/stray_temp.htm
    There is also a script to force the wakeup of smon

  • Using temporary tablespaces to improve sort

    I have to do a select like "SELECT X FROM ABC ORDER BY X", where X is the primary key, thus, is indexed.
    There is more than 80000 records, and its taking more than 10 seconds to get the response....
    After creating a temporary tablespace, how do I do a Select using this tablespace?
    null

    Hi everybody
    Executing the script utlxplan.sql, and after the script explain.sql, I got the "route" done by the query I need.
    The table's name is CADIT. Primary Key cod_cp. The column used for the where clause is familia,indexed with the index IT1.
    In the first case, the query was
    SELECT COD_CP FROM CADIT
    WHERE FAMILIA='600' ORDER BY COD_CP
    The plan is this:
    OPERATION OPTIONS OBJECT_NAME
    SELECT STATEMENT
    SORT ORDER BY
    TABLE ACCESS BY INDEX ROWID CADIT
    INDEX RANGE SCAN IT1
    In the second case, the query was SELECT COD_CP FROM CADIT WHERE FAMILIA='600'
    The plan is this:
    OPERATION OPTIONS OBJECT_NAME
    SELECT STATEMENT
    TABLE ACCESS BY INDEX ROWID CADIT
    INDEX RANGE SCAN IT1
    In the third case, the query was SELECT COD_CP FROM CADIT ORDER BY COD_CP
    The plan is this:
    OPERATION OPTIONS OBJECT_NAME
    SELECT STATEMENT
    SORT ORDER BY
    TABLE ACCESS FULL CADIT
    Thus, looking at it, I concluded that no index is used for the SORT operation. Is that correct?
    I created another table, named cadit2, with the parameter ORGANIZATION INDEX at the end of the CREATE TABLE command. For that new table, the same query as the first one was much faster. Why?
    Thanks
    Guillermo Nudelman Hess

Maybe you are looking for

  • Executing Scenario on the basis of a variable.

    Hi I have a requirement of executing one interface out of more than 2 interfaces on the basis of incoming variable value in a package. For Eg: Scenario is like .., one variable named as 'VAR_LOCAL' returns one 'filecode' value. --> filecode can have

  • Why won't iTunes recognize all the pictures in a folder I am trying to sync

    I am trying to add a separate folder  with 160 pictures in it to my iphone 4 but iTunes is only recognizing 83 of them the are all jpeg and roughly the same size they are not read only.

  • JTable selection problem with jdk1.5.0_05

    Today I tried the new jdk1.5.0_05 release and noticed with a JTable I can only select a single column and row with the mouse. With jdk1.5.0_05 I could select multiple cols and rows with the mouse. I looking at the listselectionmodel for the jtable i

  • SAP Java Gui in Solaris 10 x86.

    Who run the Java Gui in Solaris 10 x86? After I installed Java Gui in Solaris 10 x86 and run guilogon, when I connect the server I created, I got the error message: Attempt to load shared library /opt/SAPClients/SAPGui7.00/binlibJPlatin.so failed. Th

  • How to lock a particular applicatio​n

    Hi, I want to lock a particular application in device. Can any one tel me this........