Showing posts with label DBA Core. Show all posts
Showing posts with label DBA Core. Show all posts

Thursday, October 20, 2016

AWR Snapshots are not generated Automatically

Scenario:
------------

Oracle Database 11.2.0.4. My AWR Snapshots were not being generated even though it was full enabled.

Basic Checks done:
------------------------

1. Checked that I had enough free space on SYSAUX tablespace. I was using only 5GB of the total 20GB.
2. System Parameter statistics_level was TYPICAL.
3. DBMS_STATS.GET_STATS_HISTORY_RETENTION was to 30 days.
4. The snapshot Interval was 60 minutes and Retention was 8 days.

Query Check the AWR intervals:
=========================
select
extract( day from snap_interval) *24*60+
extract( hour from snap_interval) *60+
extract( minute from snap_interval ) "Snapshot Interval",
extract( day from retention) *24*60+
extract( hour from retention) *60+
extract( minute from retention ) "Retention Interval"
from
dba_hist_wr_control;

5. Everything was OK,So finally checked the process responsible for AWR collection ie) MMON

Now MMON was not running.

Now it is a critical system and CRP testing is going, So i cannot bring down the system but i need to spawn the MMON process.

Here is the workaround :
-------------------------------

Just enable and disable the restricted sessions.

SQL> alter system enable restricted session;

System altered.

SQL> alter system disable restricted session;

System altered.

Now check the MMON.

[oradoyen@saravanadb trace]$ ps -ef|grep mmon
oradoy  9732     1  3 18:46 ?        00:00:00 ora_mmon_ORADOY
oradoy  9977 50953  0 18:47 pts/8    00:00:00 grep mmon
oradoy 28182     1  0 Oct10 ?        00:11:40 ora_mmon_DEV

Now AWR snapshots started generating.

Note :
Actually this is a bug in 11.2.0.4 and it is fixed by a patch 19565533.

Note id : 2023652.1 AWR Snapshots Are Not Being Created Because MMON Is Not Being Respawned


Monday, July 20, 2015

ORA-02085: database link DOYEN_REMOTEDB.DOYENSYS@USERNAME connects to DOYEN_REMOTEDB

ERROR:
=====

ORA-02085: database link DOYEN_REMOTEDB.DOYENSYS@USERNAME connects to DOYEN_REMOTEDB

SCENARIO:
========

SQL> select * from dual@DOYEN_REMOTEDB@USERNAME;
select * from dual@DOYEN_REMOTEDB@USERNAME

ERROR in líne 1:

ORA-02085: database link DOYEN_REMOTEDB.DOYENSYS@USERNAME connects to DOYEN_REMOTEDB

REASON :
=======

Global name in the database connecting to the remote is set to TRUE.

select name, value from v$parameter where name in ('db_name', 'db_domain', 'global_names');
NAME                 VALUE
-------------------- ----------------------------------------
db_domain
global_names         TRUE
db_name              mydb

SOLUTION :
=========

Simply at local db set

alter system set global_Names = FALSE;

Now it will work fine.

Friday, September 5, 2014

Enable Auditing for DB user login attempts in 11g


1 - Add initialization parameters & bounce instance:

alter system set audit_trail=db scope=spfile;
audit_file_dest='/u01/app/oracle/mysid/mydir/'


2 - Enable auditing of failed logion attempts :

SQL> audit create session whenever not successful;


To view all the login attempts either success or failure :
========================================

col os_username format a15
col username format a15
col terminal format a15
col to_char(timestamp) format a35
select os_username,username,terminal,to_char(timestamp,'MM-DD-YYYY HH24:MI:SS') from dba_audit_trail;


To view the failed login attempts:
========================

set lines 130
col OS_USERNAME for a20
col USERNAME for a20
col USERHOST for a20
select OS_USERNAME,USERNAME,USERHOST,to_char(timestamp,'MM-DD-YYYY HH24:MI:SS'), returncode
from dba_audit_trail
where returncode > 0;



Also we can able to see the sys failed and succesful login attempts in audit_file_dest files.

Saturday, August 16, 2014

HUNG IN AUTO SQL TUNING TASK


Scenario:

In 11.2.0.3 database , we get alert in EM related to metric “Generic Operational Error” or "Generic Operational Error Status ". Occasionally when running Automatic SQL Tuning the following messages may appear in the alert log:


Error :

Sat Aug 16 07:10:54 2014
Process 0x0x85865e800 appears to be hung in Auto SQL Tuning task
Current time = 1408187453, process death time = 1408187402
Attempting to kill process 0x0x85865e800 with OS pid = 2289
OSD kill succeeded for process 0x85865e800
Sat Aug 16 07:13:00 2014

Solution:

The explanation is that the AUTO SQL TUNING TASK has been over-running and as a protective measure it is auto killed. As thus, there is no fix for this and the solution is to disable this job and eventually manually execute it when

needed. Here is how to do that:

To Disable the job:

BEGIN
   DBMS_AUTO_TASK_ADMIN.DISABLE(
   client_name => ‘sql tuning advisor’,
   operation => NULL,
   window_name => NULL);
 END;
 /


To Enable it when needed.

BEGIN
DBMS_AUTO_TASK_ADMIN.ENABLE(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/


Reference:

“How to Avoid or Prevent Hung Auto Tuning Task Messages [ID 1344499.1]”

Thursday, April 17, 2014

ORA-00600: internal error code, arguments: [4194]

ERROR:
======

ORA-00600: internal error code, arguments: [4194], [#], [#], [], [], [], [], []

CAUSE:
======

This also can be cause by the following defect

Bug 8240762 Abstract: Undo corruptions with ORA-600 [4193]/ORA-600 [4194] or ORA-600 [4137] after SHRINK

Details:

Undo corruption may be caused after a shrink and the same undo block may be used
for two different transactions causing several internal errors like:

SOLUTION:
=========

startup mount

SQL>  select * from v$logfile;

    GROUP# STATUS  TYPE
---------- ------- -------
MEMBER
--------------------------------------------------------------------------------
IS_
---
         3         ONLINE
/u03/app/oracle/oradata/star/redo03.log
NO

         2         ONLINE
/u03/app/oracle/oradata/star/redo02.log
NO

    GROUP# STATUS  TYPE
---------- ------- -------
MEMBER
--------------------------------------------------------------------------------
IS_
---
         1         ONLINE
/u03/app/oracle/oradata/star/redo01.log
NO

/u03/app/oracle/oradata/star/undotbs01.dbf


SQL> show parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1

If We are using pfile then edit pfile and change the parameter :
=========================================

undo_management=MANUAL

If you are using spfile then
====================

alter system set undo_management = MANUAL scope=spfile;

alter database open;

Now drop the undo file
================

alter database datafile  '/u03/app/oracle/oradata/star/undotbs01.dbf' offline drop;

Drop the tablespace :
=============
drop tablespace UNDOTBS1;

Got the following error while droping the tablespace:
===================================

ERROR at line 1:
ORA-01548: active rollback segment ‘_SYSSMU11$’ found, terminate dropping tablespace

Inorder to ignore this error,
==================

SQL> select segment_name,status,tablespace_name from dba_rollback_segs where status='NEEDS RECOVERY';

SEGMENT_NAME                   STATUS           TABLESPACE_NAME
------------------------------ ---------------- ------------------------------
_SYSSMU1_3780397527$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU2_2232571081$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU3_2097677531$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU4_1152005954$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU5_1527469038$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU6_2443381498$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU7_3286610060$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU8_2012382730$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU9_1424341975$           NEEDS RECOVERY   UNDOTBS1
_SYSSMU10_3550978943$          NEEDS RECOVERY   UNDOTBS1

10 rows selected.

Now shut down the database.

Add the lines in pfile inorder to ignore the segments that are used :
=================================================

_corrupted_rollback_segments =

('_SYSSMU1_3780397527$','_SYSSMU2_2232571081$','_SYSSMU3_2097677531$','_SYSSMU4_1152005954$','_SYSSMU5_1527469038$','_SYSSMU6_2443381498$','_SYSSMU7_32866100

60$','_SYSSMU8_2012382730$','_SYSSMU9_1424341975$','_SYSSMU10_3550978943$')


SQL> STARTUP MOUNT pfile='/u03/app/oracle/product/11.2.0/db_1/dbs/initstar.ora'
ORACLE instance started.

Total System Global Area  242208768 bytes
Fixed Size                  2212168 bytes
Variable Size             184553144 bytes
Database Buffers           50331648 bytes
Redo Buffers                5111808 bytes
Database mounted.

SQL> alter database open;

Database altered.

drop tablespace UNDOTBS1;

Now create the new undo tablespace with datafile.
====================================

create UNDO tablespace undotbs1 datafile '/u03/app/oracle/oradata/star/undotbs01_1.dbf' size 25m autoextend on next 1m maxsize 1024m;

Now start with spfile and make undo_management AUTO.

alter system set undo_management = AUTO scope=spfile;

REFERENCE :
========

Step by step to resolve ORA-600 4194 4193 4197 on database crash (Doc ID 1428786.1)


Wednesday, July 31, 2013

ORA-10873: file 1 needs to be either taken out of backup mode or media recovered

Scenario :

Database went down due to power fluctuation and during that time hot backup was running.So once we started the database we face the following issue.

Error:

ORA-10873: file 1 needs to be either taken out of backup mode or media recovered
ORA-01110: data file 1: '/system/PROD/system01.dbf'

Cause:

Database in backup mode while it went down.

Solution:

Step 1 : Sqlplus  ‘/as sysdba’
Step 2 : startup mount
Step 3 : Check backup file using below command.
            select * from V$BACKUP
Step 4 : The following command can be used to take all of the data files out of hot backup mode:
            ALTER DATABASE END BACKUP;
Step 5 : Alter database open

Friday, April 5, 2013

OPatch failed with error code 73


Scenario :
=========

While running opatch lsinventory we get the following error in db Tier


Error :
======

$ opatch lsinventory

Invoking OPatch 11.1.0.6.2
Oracle Interim Patch Installer version 11.1.0.6.2
Copyright (c) 2007, Oracle Corporation.  All rights reserved.

Oracle Home       : /test/oracledb/db/tech_st/11.1.0
Central Inventory : /testapps/apps/tech_st/10.1.2/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.2
OUI version       : 11.1.0.7.0
OUI location      : /test/oracledb/db/tech_st/11.1.0/oui
Log file location : /test/oracledb/db/tech_st/11.1.0/cfgtoollogs/opatch/opatch2013-04-04_15-47-50PM.log
List of Homes on this system:
  Home name= TEST_WEBOH__testapps_apps_tech_st_10_1_3, Location= "/testapps/apps/tech_st/10.1.3"
  Home name= TEST_TOOLS__testapps_apps_tech_st_10_1_2, Location= "/testapps/apps/tech_st/10.1.2"
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
   Oracle Home dir. path does not exist in Central Inventory
   Oracle Home is a symbolic link
   Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo
OPatch failed with error code 73

Reason :
======

The Central Inventory is pointing to Wrong location and also the path inside the Inventory may points to PROD. So just change the inventory location to point to TEST and also check whether it presents.

Solution:
=========

Change the Location points to TEST in the following 

$ cat /etc/oraInst.loc
/test/oracledb/db/tech_st/11.1.0/admin/oui/TEST_test/oraInventory

$ pwd
/test/oracledb/db/tech_st/11.1.0/admin/oui/TEST_test/oraInventory/ContentsXML

$ cat inventory.xml_bkp |grep PROD


Change the following path points to TEST

$ cat inventory.xml |grep PROD



Reference Note id:
=================

OPatch Fails With "LsInventorySession failed:OracleHomeInventory gets null oracleHomeInfo" [ID 728417.1]

To create the New Inventory :
============================

Note : Please replace with the name that you want to give this OracleHome. (Reference: 864117.1)

Tuesday, January 29, 2013

Error Code 160 With OPatch, Crash In $ORACLE_HOME/jdk/jre/bin/libj9jit23.so (Unhandled Exception )


Error:
======

Error Code 160 With OPatch, Crash In $ORACLE_HOME/jdk/jre/bin/libj9jit23.so (Unhandled Exception )

cskront1(/app/oracle/product/11.1.0/OPatch): ./opatch lsinventory
Unhandled exception
Type=Segmentation error vmState=0x00000000
J9Generic_Signal_Number=00000004 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000033
Handler1=09001000A0ABBC78 Handler2=09001000A0AB3538
R0=0000000000000000 R1=0FFFFFFFFFFFB8B0 R2=0000000000000011 R3=0000000000000017
R4=07000000001AB028 R5=00000001115D7D80 R6=00000001115D7CB8 R7=00000001115D7CB8
R8=0000000000000000 R9=00000001115D7D80 R10=0000000110256648 R11=0900000006330C38
R12=00000001109E5AD8 R13=000000011000EAA0 R14=00000001115D7D80 R15=00000001101F5700
R16=0000000110A8BAF0 R17=000000011151B278 R18=09001000A0ABF3B0 R19=0000000000000041
R20=000000011151A508 R21=00000001115D7F28 R22=00000001101F5780 R23=0000000000000000
R24=0000000003FCC9D8 R25=07000000001A77C0 R26=FFFFFFFFFFFFFFFF R27=0000000000000017
R28=07000000001AB1E8 R29=0000000000000002 R30=0000000000000015 R31=0000000000000000
IAR=0900000006330C38 LR=00000001102567FC MSR=A00000000000D032 CTR=0900000006330C38
CR=8254508420000006 FPSCR=8202000000000000 XER=2000000682020000
FPR0 0000000800000008 (f: 8.000000, d: 1.697597e-313)
FPR1 41e0000000000000 (f: 0.000000, d: 2.147484e+09)
FPR2 3fe8000000000000 (f: 0.000000, d: 7.500000e-01)
FPR3 c530000000000000 (f: 0.000000, d: -1.934281e+25)
FPR4 3f30000000000000 (f: 0.000000, d: 2.441406e-04)
FPR5 3fd6666666666666 (f: 1717986944.000000, d: 3.500000e-01)
FPR6 3ff0000000000000 (f: 0.000000, d: 1.000000e+00)
FPR7 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR8 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR9 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR10 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR11 4026000000000000 (f: 0.000000, d: 1.100000e+01)
FPR12 3fe8000000000000 (f: 0.000000, d: 7.500000e-01)
FPR13 4020800000000000 (f: 0.000000, d: 8.250000e+00)
FPR14 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR15 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR16 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR17 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR18 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR19 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR20 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR21 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR22 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR23 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR24 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR25 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR26 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR27 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR28 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR29 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR30 0000000000000000 (f: 0.000000, d: 0.000000e+00)
FPR31 0000000000000000 (f: 0.000000, d: 0.000000e+00)
Module=/app/oracle/product/11.1.0/jdk/jre/bin/libj9jit23.so
Module_base_address=0900000006306000
Target=2_30_20070131_11312_BHdSMr (AIX 6.1)
CPU=ppc64 (8 logical CPUs) (0x400000000 RAM)
JVMDUMP006I Processing Dump Event "gpf", detail "" - Please Wait.
JVMDUMP007I JVM Requesting System Dump using '/app/oracle/product/11.1.0/OPatch/core.20110915.083824.27656416.dmp'
JVMDUMP010I System Dump written to /app/oracle/product/11.1.0/OPatch/core.20110915.083824.27656416.dmp
JVMDUMP007I JVM Requesting Snap Dump using '/app/oracle/product/11.1.0/OPatch/Snap0001.20110915.083824.27656416.trc'
JVMDUMP010I Snap Dump written to /app/oracle/product/11.1.0/OPatch/Snap0001.20110915.083824.27656416.trc
JVMDUMP007I JVM Requesting Java Dump using '/app/oracle/product/11.1.0/OPatch/javacore.20110915.083824.27656416.txt'
JVMDUMP010I Java Dump written to /app/oracle/product/11.1.0/OPatch/javacore.20110915.083824.27656416.txt
JVMDUMP013I Processed Dump Event "gpf", detail "".

OPatch failed with error code 160


Scenario:

========
While running opatch lsinventory we get the above error. 
We are running 11.1.0.7 With R12.1.1 in IBM AIX 6.1  64 bit.

Cause

======
The JAVA_COMPILER environment variable needs to be set to NONE.

Solution:

=========
Export the environment variable JAVA_COMPILER=NONE
export JAVA_COMPILER=NONE

Reference:

=========
Error Code 160 With OPatch, Crash In $ORACLE_HOME/jdk/jre/bin/libj9jit23.so (Unhandled Exception Type=Segmentation Error Vmstate=0x00000000 J9Generic_Signal_Number=...) [ID 1359047.1]

Tuesday, September 28, 2010

Avoid logging in / as sysdba

AIM : To avoid a user to connecting to Database using connect /as sysdba
After the User log-in to OS,We can follow two methods.
STEP 1 : In sqlnet.ora file modify the following line to SQLNET.AUTHENTICATION_SERVICES=(NONE)

STEP 2 : Remove dba group to the user who is logging in to the system.
Note : orapwd file is used to authenticate users over the network only.users who already logged in to the system can’t be restricted to connect ‘/as sysdba’

RESTRICT TNS CONNECTION FOR CLIENT

RESTRICT TNS CONNECTION FOR CLIENT :
====================================

TARGET SERVER : VIS
CLIENT SERVER : SAMPLE.DOYEN.IN

SCENARIO :
=========

STEP 1 : We are restricting the TNS Access for the VIS server and Permitting only the SAMPLE.DOYEN.IN server.
STEP 2 : Add the Below entry in the sqlnet.ora file in the VIS Server.
STEP 3 : Restart the Listener in the VIS Server
STEP 4 : Now check connecting from some other server ex. TEST.DOYEN.IN it will says "TNS CONNECTION CLOSED".
STEP 5 : IF you connect from the SAMPLE.DOYEN.IN it will connect.

NAMES.DIRECTORY_PATH=(TNSNAMES, ONAMES, HOSTNAME)
SQLNET.EXPIRE_TIME= 10
tcp.validnode_checking = yes
tcp.invited_nodes=(sample.doyen.in,192.168.2.143)

Wednesday, April 8, 2009

Change DBID

Change the Dbid for the Oracle Database:
==========================================================

Steps To Be Followed:
=====================

Please check the Parameter

Make this Cluster_Node = False if it is TRUE and Cluster Instance = 1 if it is 2.

1. SQL> select DBID,name from v$database;


DBID NAME
-------- ----
14211234
DBA

2. SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


3. SQL> startup mount pfile=/DBA10gR2/app/oracle/dbs/initDBA.ora

ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size 1265844 bytes
Variable Size 360714060 bytes
Database Buffers 700448768 bytes
Redo Buffers 11313152 bytes
Database mounted.


4. From the Command Prompt Give the Following :

[oracle@oradbdba dbs]$ nid target=sys/Passwd

DBNEWID: Release 10.2.0.3.0 - Production on Fri Feb 13 07:36:32 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database DBA (DBID=14213988)
Connected to server version 10.2.0
Control Files in database:
/DBAData/datafiles/controlfile/cntrl01.dbf
/DBAData/onlinelogs/controlfile/cntrl02.dbf
/DBAData/archivelogs/controlfile/cntrl03.dbf
Change database ID of database DBA? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 14213988 to 1137975361
Control File /DBAData/datafiles/controlfile/cntrl01.dbf - modified
Control File /DBAData/onlinelogs/controlfile/cntrl02.dbf - modified
Control File /DBAData/archivelogs/controlfile/cntrl03.dbf - modified
Datafile /DBAData/datafiles/system01.dbf - dbid changed
Datafile /DBAData/datafiles/system02.dbf - dbid changed
Database ID for database DBA changed to 1137975361.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.


Note : Now the database will be shutdown automatically. So now we want to starup mount and open with reset logs;

5. SQL> startup mount pfile=/DBA10gR2/app/oracle/dbs/initDBA.ora

ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 1265844 bytes
Variable Size 360714060 bytes
Database Buffers 700448768 bytes
Redo Buffers 11313152 bytes
Database mounted.

6. SQL> alter database open resetlogs;
Database altered.

7. SQL> select dbid,name from v$database;


DBID NAME
---------- ------
11379734937 DBA

Wednesday, April 1, 2009

Change the Location of the Control file:


How to change the Location of the Control file:
=====================================


Old Location:
=========


/oracle/product/10.2.0/oradata/test/control01.ctl,
/oracle/product/10.2.0/oradata/test/control02.ctl,
/oracle/product/10.2.0/oradata/test/control03.ctl

New Location (To be changed):
====================

/oracle/product/10.2.0/oradata/test/control01.ctl,
/oracle/product/10.2.0/oradata/test/controlfile/control02.ctl,
/Orabkp/oracle/controlfile/test/control03.ctl

Scenario :
=======


Now the Database is running in spfile.

Procedure to be Followed:
=====================

1. Down the Database.
2. Move the Existin spfile.
3. Backup the existing inittest.ora file.
4. Make the changes ie) add the New path to the Control file in the inittest.ora file.
5. copy all the control file for test from old Location to the respective place where we need to change by using cp command.
7. startup the Database
8. Create spfile from pfile
9. Down the Database to startup with new spfile
10. Now startup the database with new spfile
11. Login to sqlplus and check show parameter control. It will show the New Location.

Friday, February 20, 2009

ORA-01950: no privileges on tablespace 'TBS_NAME'

Metalink Id : 1012307.6

Scenario:
=======

When a new tablespace (SAMPLE) is created as a sysdba. Now if we are going to move some tables are indexes from existing tablespace (OLD_TBS_NAME) to that new tablesapce sample throws the following error.

Error:
=====

ORA-01950: no privileges on tablespace 'SAMPLE'

Solution:
======

Grand access to the users who have access to the old_tbs to that tablespace sample. By

This query will give the output to have a permission to that new tablespace to all the users who are having permission in the old_tbs_name. So take a output of this query and store it as .sql and run the output.

select 'alter user 'username ' quota unlimited on SAMPLE;' from dba_users where username in (select distinct owner from dba_tables where TABLESPACE_NAME='OLD_TBS_NAME');

General script:
==========

We can also select the users (more than 1 user) and give access to all tablespace to all the users by:


GRANT UNLIMITED TABLESPACE TO APPLSYS,XNP,AR,CCT,IEO,CS,AMV,IEM,XDP,APPS,IBU,JTF,OKC;

Revoke :
=======

REVOKE unlimited tablespace FROM user_name;