Solved

query

Posted on 2012-12-31
5
220 Views
Last Modified: 2013-01-16
SQL> create tablespace my_tb datafile '/u01/oracle/oradata/repdb/my_tbs.dbf' size 100m; Tablespace created.


 SQL> create table my_tab tablespace my_tbs as select * from dba_objects;

why we are using the part " select * from dba_objects" in the query.....


??
0
Comment
Question by:walkerdba
5 Comments
 
LVL 9

Expert Comment

by:armchair_scouse
Comment Utility
Presumably to adopt the structure/columns of dba_objects as the basis of the structure of your table my_tbs, and possibly to import any records from dba_objects if there are any present in the table.

Happy New Year!!
0
 
LVL 23

Expert Comment

by:David
Comment Utility
The sys.dba_objects view shows the data dictionary (every database object).  It is a commonly cited set of "random" data.  As your example shows, it's a quick way to populate a test table.  The other advantage is that it gives you a consistent test bed if you need to drop and repopulate the table.
0
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
Comment Utility
you have 2 different names of tablespace in the 2 commands.

tablespace created: MY_TB
table destination tablespace: MY_TBS

was the intention not the same tablespace  ?
or just a typo ... :)
0
 
LVL 34

Expert Comment

by:Mark Geerlings
Comment Utility
Or, are you asking: "Why create a table that is a copy of data that is already available from a view?"  One reason for doing this is for performance.  If you need to retrieve this data multiple times, repeated queries of this table will likely be much faster (and cause many fewer logical block reads) than a query from the view.
0
 

Author Closing Comment

by:walkerdba
Comment Utility
solved
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.

Join & Write a Comment

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now