Sunday, July 7, 2019

Move or Rename Tempfile in Oracle


Move or Rename Tempfile in Oracle

#####  Move tempfile from location  ‘/u01/data/temp01.dbf’ to ‘/u03/data/temp01.dbf’  #####

SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE#  FILE_NAME STATUS
-----------------------------------------------
 1  /u01/data/temp01.dbf  ONLINE
 2 /u02/data/temp02.dbf   ONLINE

SQL> ALTER DATABASE TEMPFILE '/u01/data/temp01.dbf' OFFLINE;

Database altered.

SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
 FILE# FILE_NAME STATUS
----------------------------------------------------
 1 /u01/data/temp01.dbf  OFFLINE
 2 /u02/data/temp02.dbf  ONLINE


#Copy the old temp files to other location(/u03):

SQL> !cp -p /u01/data/temp01.dbf /u03/data/temp01.dbf;

SQL> ALTER DATABASE RENAME FILE '/u01/data/temp01.dbf' TO '/u03/data/temp01.dbf';

Database altered.

SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
  FILE#   FILE_NAME STATUS
--------------------------------------------------------
  1    /u03/data/temp01.dbf OFFLINE
  2   /u02/data/temp02.dbf  ONLINE

SQL> ALTER DATABASE TEMPFILE '/u03/data/temp01.dbf' ONLINE;

Database altered.

SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
 FILE# FILE_NAME STATUS
---------------------------------------------------------
 1 /u03/data/temp01.dbf   ONLINE
 2 /u02/data/temp02.dbf   ONLINE


#Remove the old temp file
SQL> !rm -rf /u01/data/temp01.dbf



here: moving temfile temp tablespace oracle 11g

How to deal with ORA-00020: maximum number of processes (%s) exceeded

sqlplus /nolog

 SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 6 09:07:23 2014

 Copyright (c) 1982, 2013, Oracle.  All rights reserved.
 @ SQL> connect /
 ERROR:
 ORA-00020: maximum number of processes (1000) exceeded
I then found the page by tech.e2sn.com that showed how to use sqlplus with the "preliminary connection".

Simply by using
sqlplus -prelim "/as sysdba"
I was able to connect and shutdown the database with the abort option.
sqlplus -prelim "/ as sysdba"

 SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 6 09:09:15 2014
 Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 SQL> shutdown abort
 ORACLE instance shut down.
 SQL> exit
 Disconnected from ORACLE
After this point the database could once again be restarted:
sqlplus / as sysdba

 SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 6 09:10:38 2014
 Copyright (c) 1982, 2013, Oracle.  All rights reserved.
 Connected to an idle instance.
SQL> startup
 ORACLE instance started.

 Total System Global Area 2137886720 bytes
 Fixed Size                  2248080 bytes
 Variable Size            1258291824 bytes
 Database Buffers          855638016 bytes
 Redo Buffers               21708800 bytes
 Database mounted.
 Databasen opened. 
 
here : maximum number exeed - oracle 

Mysql Check version one line



mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'

here: mysql check version in linux