Since the level of developers is high and low, dba has limited energy, and it is impossible to solve the SQL statement problem in time! We plan to solve the slow database operation problem by imitating the methods of redo logs!
1. View usage/remaining space of temporary files
- Select (BYTES_USED + BYTES_FREE)/1024/1024."Total space M", Bytes _ used/1024/1024"Use space M"From v $ temp_space_header;
2. view the temporary tablespace to which the current user belongs
- Select username, temporary_tablespace from dba_users;
USERNAME TEMPORARY_TABLESPACE
-----------------------------------------
SYS TEMP1
SYSTEM TEMP1
DBSNMP TEMP1
HUJINPEI TEMP1
ALAN1 TEMP1
PERFUSER TEMP1
ALAN2 TEMP1
MYUSER TEMP1
OUTLN TEMP1
WMSYS TEMP1
10 rows have been selected.
3. view the temporary files.
- Select name from v $ tempfile;
4. Create a data file on the bare Device
A. create the desired link in the file system
For example, cd/sgerp5/sgerp5
Touch temp03.dbf
B. Create a soft link
Note: Please be careful during this step,The/dev/sgerp5_sgtemp03 directory cannot be wrong. If it is wrong, the mount is successful, but it may cause various strange errors.
① -- Create a data file
Mklv-y sgerp5_temp03-t o-t raw-a ie-e x sgvg 60 hdisk2 hdisk3 hdisk4 hdisk5
② -- Create a link
Ln-fs/dev/sgerp5_sgtemp03/sgerp5/sgerp5/temp03.dbf
5. recreate a temporary tablespace: Check the script carefully. The temporary tablespace creation command is not the same as the temporary tablespace creation command.
- CREATE TEMPORARY TABLESPACE"TEMP3"TEMPFILE
- '/Sgerp5/sgerp5/temp03.dbf'SIZE 10G
- Autoextend on next 655360 MAXSIZE 30G
- Extent management local uniform size 1048576;
6. Set the created TEMP tablespace to the default temporary tablespace of the database:
- Alter databaseDefaultTemporary tablespace temp;
- -- View the default tablespace
- Select username, temporary_tablespace from dba_users;
7. DROP the tablespace of the old TEMP1 :(Skip to Step 10 without dropping)
- Drop tablespace temp1 including contents and datafiles;
8. If drop fails, the current temporary tablespace may be used. Wait until the session is released and check who occupies the temporary tablespace.
- SELECT se. username,
- Sid,
- Serial #,
- SQL _address,
- Machine,
- Program,
- Tablespace,
- Segtype,
- Contents
- FROM v $ session se,
- V $ sort_usage su
- HERE se. saddr = su. session_addr