Solved

tablespace location

Posted on 2012-12-30
13
487 Views
Last Modified: 2013-01-18
How would I find the tablespace of a particular schema?

Please help..
0
Comment
Question by:walkerdba
  • 3
  • 3
  • 2
  • +3
13 Comments
 
LVL 22

Accepted Solution

by:
Steve Wales earned 100 total points
ID: 38731357
If you're looking for the default tablespace name for a user:

select default_tablespace from dba_users where username = 'YOUR_USER';

If you're looking for all the tablespaces that a user may have quotas on:

select tablespace_name from dba_ts_quotas where username = 'YOUR_USER';
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 100 total points
ID: 38731524
To ad to the post above:  A schema in Oracle is just a user that owns objects.  These objects can be in any tablespace.  If you do not declare a specific tablespace when you create the object, it is created in the users 'default' tablespace.

You typically create objects in different tablespaces.  Like one for tables and one for indexes.

You can even create tablespaces with different block sizes for specific objects that may get a performance gain from it.
0
 

Author Comment

by:walkerdba
ID: 38731912
SQL> select tablespace_name from dba_ts_quotas where username = 'SCOTT';

no rows selected

SQL> select tablespace_name from dba_ts_quotas where username ='SCOTT';

no rows selected

SQL>

Why it is like this.....?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Steve Wales
ID: 38731994
This means that SCOTT has no tablespace as his default and has no quotas on any tablespaces.

If you want to see the tablespaces you do have:

select * from dba_tablespaces;
select * from dba_data_files;
select * from dba_temp_files;
0
 

Author Comment

by:walkerdba
ID: 38732059
How can a schema sit nowhere without tablespace?
Scott should be somewhere right?

My mission is to find out which tablespace SCOTT..
0
 
LVL 34

Assisted Solution

by:johnsone
johnsone earned 100 total points
ID: 38732403
If you are looking for the tablespaces that the schema is currently using, I would use this:

SELECT DISTINCT TABLESPACE_NAME
FROM DBA_SEGMENTS
WHERE OWNER = 'SCOTT';

If the user has the UNLIMITED TABLESPACE privilesge, then there will be no records in DBA_TS_QUOTAS and there doesn't need to be.
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 38732676
As slightwv mentioned, a schema in Oracle is just a user that owns objects.

It is possible to create a user that does not have any objects (and hence, all of the above queries would return nothing).

johnsone also makes a valid point, you'd need to check dba_sys_privs (to see which users have that system privilege):

select * from dba_sys_privs where privilege = 'UNLIMITED TABLESPACE';

It sounds like you misunderstand what a schema is in Oracle.  It is a different concept to SQL Server, for example.

It is very possible to have users without objects in Oracle.
0
 
LVL 35

Assisted Solution

by:Mark Geerlings
Mark Geerlings earned 100 total points
ID: 38733130
A tablespace in Oracle is a physical place (one or more files on disk) that can contain tables and indexes.  A schema is a logical concept in Oracle that by default doesn't correspond to any physical tablespaces.  You can assign a default tablespace to a schema, but that schema is not necessarily limited to creating objects only in its default tablespace.  For example, you can grant a schema the "unlimited tablespace" privilege.  That allows the schema to create objects in any tablespace.
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 100 total points
ID: 38735935
does user SCOTT actually exist in your database ?

check following query results:

select * from dba_users where username = 'SCOTT';
0
 

Author Comment

by:walkerdba
ID: 38765232
I've requested that this question be closed as follows:

Accepted answer: 0 points for walkerdba's comment #a38731912

for the following reason:

yes
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38765233
>> closed by accepting walkerdba's comment #a38731912 (0 points) as the solution for the following reason:  yes

I'm afraid I'll have to object to the way you want to close this.
Please accept the post or posts that assisted you in answering the question.

I suggest a split of the points since it appears several posts helped.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MULTIPLE DATE QUERY 15 91
Error querying database link from Oracle 10g to Postgresql 7 65
Oracle 12c Default Isolation Level 17 41
subtr returning incorrect value 8 31
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question