|
|
|
|
|
|
Re: Taking Tablespace Offline [message #571378 is a reply to message #571369] |
Sun, 25 November 2012 02:13 |
John Watson
Messages: 8962 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Your exact release is critical, and so is whether you run the commands as SYS or as a regular user. See this:orcl>
orcl> alter tablespace users offline;
Tablespace altered.
orcl> create table t1(c1 date) tablespace users;
Table created.
orcl> insert into t1 values(sysdate);
insert into t1 values(sysdate)
*
ERROR at line 1:
ORA-01542: tablespace 'USERS' is offline, cannot allocate space in it
orcl> select * from v$version;
BANNER
-------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
orcl> sho parameter defer
NAME TYPE VALUE
------------------------------------ ----------- ------------------------
deferred_segment_creation boolean TRUE
orcl> and read up on the parameter I've shown at the end.
|
|
|
|
|
|
|
|
|
|
Re: Taking Tablespace Offline [message #571397 is a reply to message #571394] |
Sun, 25 November 2012 09:43 |
|
raja_dba
Messages: 33 Registered: November 2012 Location: India
|
Member |
|
|
If my understanding is correct, A table structure does exists, after inserting any datas and so far what I have learned is to insert just data values.
SQL > insert into <table_name> values (1,oracle);
SQL> desc <table_name>
The table structure does remains the same after inserting datas.
[Updated on: Sun, 25 November 2012 10:05] Report message to a moderator
|
|
|
Re: Taking Tablespace Offline [message #571402 is a reply to message #571397] |
Sun, 25 November 2012 10:36 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
In your case:
1/ CREATE TABLE creates the definition of the table in Oracle dictionary
2/ The first INSERT then creates the segment, the associated physical object, in the tablespace.
Please read Database Concepts.
Note that if you post false information you will not have correct answers.
I hope you now know, from John's and my answers, how you have to post.
Regards
Michel
[Updated on: Sun, 25 November 2012 11:18] Report message to a moderator
|
|
|
|
Re: Taking Tablespace Offline [message #571406 is a reply to message #571369] |
Sun, 25 November 2012 11:20 |
John Watson
Messages: 8962 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Raja, I think you should have enough information now to understand the difference between the logical table and the physical segment, and where these structures exist. When you are happy with that, here is your next exercise. Explain this behaviour:orcl> create table t1 (c1 date) tablespace users;
Table created.
orcl> insert into t1 values(sysdate);
1 row created.
orcl> alter tablespace users read only;
Tablespace altered.
orcl> insert into t1 values(sysdate);
insert into t1 values(sysdate)
*
ERROR at line 1:
ORA-00372: file 4 cannot be modified at this time
ORA-01110: data file 4: 'C:\APP\JOHN\ORADATA\ORCL\DATAFILE\USERS.DBF'
orcl> delete from t1;
delete from t1
*
ERROR at line 1:
ORA-00372: file 4 cannot be modified at this time
ORA-01110: data file 4: 'C:\APP\JOHN\ORADATA\ORCL\DATAFILE\USERS.DBF'
orcl> drop table t1;
Table dropped.
orcl> --what?? how can that be possible????
orcl>
|
|
|
|
Re: Taking Tablespace Offline [message #571421 is a reply to message #571407] |
Sun, 25 November 2012 20:38 |
|
raja_dba
Messages: 33 Registered: November 2012 Location: India
|
Member |
|
|
Dear Michel and John,
First of all, Thank you so very much for coming down to my level ( starting from the basics ) to make me in the way I can better understand is something I really have to appreciate, I am aware you guys have huge experience in the Oracle Market and to teach guys like me from the basis should really be boring for you and in fact it is not really that necessary to give much importance as you are way higher and higher than me. But your simplicity customizing here,
orcl> --what?? how can that be possible????
It really feels like I am in a classroom where my Guru's are training me to step me up as a DBA in real time. I am very happy and I am very thankful for all the pains you have taken to make me better understand in the Database Administration. I realize its not so simple to spend time for someone, that too taking SQL copy from window and giving me exercise so I better learn in real time. Once again, Thank You for your time.
Coming down to actual question,
Yes, I understand tablespace is where data's are logically stores and datafiles where the data' are physically stored, when you have changed the tablespace to the read-only mode, which means that no further Data Manipulation is allowed until we take the tablespace to the read/write mode.
INSERT is a DML statement and hence data to be inserted are barred and again with DELETE a DML Statement the manipulation is barred.
DROP on the other end is Data Definition Language and its auto-committed. DDL statements are the structural change and it does not have any impact on the read-only mode and hence the table is dropped.
I have read the link on the "Deferred Segment Creation" and the "Database Concepts" before it is already passed but only after your example and reading it again now makes me understand,
CREATE TABLE has nothing to do with the offline tablespace or an online tablespace and the structure is created in the Oracle Dictionary. In order to save disk resources, deferred_segment_creation is being used and only at the first insert, the segment will be created and the actual table occupies space. This way we can save a lot of space for many unpopulated tables.
Could you please tell me if my understanding is correct?
Many Thanks,
Raja
|
|
|
|
|
|
|
|
|
Re: Taking Tablespace Offline [message #571457 is a reply to message #571448] |
Mon, 26 November 2012 02:55 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:When I am inserting data's without commit, it is temporarily stored in a redo log buffer, and when I commit the values, the Log Writer will write the values to the Redo Log files.
This is completly wrong.
Quote:And when a redo log file is filled and when a log switch is about to happen, the Archiver will Archive the redo log files to the Archive log files.
Correct.
Quote:Here, when is actually a data file is getting filled?
Either it extends if it is in auto-extensible mode, either the current operation fails.
Please read the book I pointed you to, you obviously didn't read it as these points are explained.
Regards
Michel
|
|
|
|
|
|
|
Re: Taking Tablespace Offline [message #571890 is a reply to message #571889] |
Mon, 03 December 2012 09:49 |
|
raja_dba
Messages: 33 Registered: November 2012 Location: India
|
Member |
|
|
I do read but I sometimes do not get the point or I lack understanding reading the manual, and only when all fails, I am here for a real time help with an example from real time people and I am thankful for whoever makes this jumbo head understand the concept. Thank You.
I do read here.. But I lack understanding, help me please if you can spare your valuable time.
http://www.ixora.com.au/tips/tuning/log_buffer_size.htm
Copied from above link :
What if the log buffer is too small?
If the log buffer is too small, then log buffer space waits will be seen during bursts of redo generation. LGWR may not begin to write redo until the _log_io_size threshold (by default, 1/3 of the log buffer or 1M whichever is less) has been exceeded, and the remainder of the log buffer may be filled before LGWR can complete its writes and free some space in the log buffer.
Ideally, the log buffer should be large enough to cope with all bursts of redo generation, without any log buffer space waits. Commonly, the most severe bursts of redo generation occur immediately after a log switch, when redo generation has been disabled for some time, and there is a backlog of demand for log buffer space.
[Updated on: Mon, 03 December 2012 09:50] Report message to a moderator
|
|
|
Re: Taking Tablespace Offline [message #571891 is a reply to message #571890] |
Mon, 03 December 2012 10:08 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:Copied from above link :
Ixora was written for version 7 (and a little bit for 8i), so forget it.
raja_dba wrote on Mon, 03 December 2012 16:19Michel Cadot wrote on Mon, 26 November 2012 14:25Quote:When I am inserting data's without commit, it is temporarily stored in a redo log buffer, and when I commit the values, the Log Writer will write the values to the Redo Log files.
This is completly wrong.
Could you please tell me where I am wrong? It is my understanding, any changes made to the database will be recorded in the redo log files before it is being written to the data file.
Modifications are written in redo log buffer then in redo log files, and in buffer cache then in files, with or without commit, depending on the timing between all operations.
Regards
Michel
[Updated on: Mon, 03 December 2012 10:21] Report message to a moderator
|
|
|
Re: Taking Tablespace Offline [message #571892 is a reply to message #571891] |
Mon, 03 December 2012 10:13 |
|
raja_dba
Messages: 33 Registered: November 2012 Location: India
|
Member |
|
|
Michel,
So the undo information stored in the undo tablespace or in the undo segments are also included in the redo, thus protecting both redo and undo in the same place?
Could you please also help me in this?
When I set the parameter Undo_tablespace=Undotbs1 and when the size of my undotbs1 is set to 1 GB in Size.
Now I have a big table of size with thousands of rows and its size is 2GB.
SQL> delete from bigtable;
Now when I have only 1GB of Undo Space available, how Oracle will handle this undo generation for "rollback"?
[Updated on: Mon, 03 December 2012 10:14] Report message to a moderator
|
|
|
Re: Taking Tablespace Offline [message #571894 is a reply to message #571892] |
Mon, 03 December 2012 10:23 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:So the undo information stored in the undo tablespace or in the undo segments are also included in the redo, thus protecting both redo and undo in the same place?
Yes, in the same redo entry.
Quote:how Oracle will handle this undo generation for "rollback"?
It cannot and, as soon as the undo data will exceed 1GB, you will have an error "ORA-01650: "unable to extend rollback segment %s by %s in tablespace %s" or "ORA-30036: "unable to extend segment by %s in undo tablespace '%s'"" or the like.
Regards
Michel
[Updated on: Mon, 03 December 2012 10:25] Report message to a moderator
|
|
|
|
|
|
|
|