Solved

Alter Table Shrink Space Question

Posted on 2013-06-10
4
737 Views
Last Modified: 2013-06-10
If I execute an Alter Table Shrink Space and it takes hours, will it lock the table so that the table cannot be INSERT UPDATE or DELETE?

Thanks!!
0
Comment
Question by:gswitz
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
The docs talk about this:
http://docs.oracle.com/cd/E11882_01/server.112/e25494/schema003.htm#ADMIN10161

Shrinking Database Segments Online

Segment shrink is an online, in-place operation. DML operations and queries can be issued during the data movement phase of segment shrink. Concurrent DML operations are blocked for a short time at the end of the shrink operation, when the space is deallocated. Indexes are maintained during the shrink operation and remain usable after the operation is complete. Segment shrink does not require extra disk space to be allocated.
0
 

Author Closing Comment

by:gswitz
Comment Utility
Thanks, SlightWV
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
yes it does require locks and existing transactions with locks on the table will prevent it from running
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
oops too slow  and interesting because it's a simple test case will show that DML does create blocking locks


-- in session 1
alter dept set deptno=deptno;

-- in session 2

alter table dept shrink space;   -- this statement will wait

-- in session 1

rollback;  -- or commit

-- in session 2

-- the shrink will now continue
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

Title # Comments Views Activity
Sql to get orphans 7 50
Migrating an SQL 2008 database to Oracle 12c 3 59
Schema creation in Oracle12c 6 20
sql query 9 18
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

772 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

13 Experts available now in Live!

Get 1:1 Help Now