Question

In: Computer Science

Simulate a problem with undo. You will need to be connected as user SYSTEM or some...

Simulate a problem with undo. You will need to be connected as user

SYSTEM or some other user to whom you have granted the DBA role.

.

Create an undo tablespace with a single datafile of only 200 KB. Do not set the file to autoextend.

.

Set the database to use this small undo tablespace. Confirm that an undo

segment has been created in this tablespace and that it is online by querying

the views DBA_ROLLBACK_SEGS and V$ROLLSTAT.

Why do you think that only one undo segment was created?

.

Create an empty table based on the ALL OBJECTS view with this statement:

create table undotest as select * from all_objects where 1=2;

.

Populate this table with the contents of the ALL OBJECTS view:

insert into undotest select * from all_objects ;

.

The statement will fail with an error "ORA-30036: unable to extend segment by 8 in undo tablespace."

Query the new table, and you will find that it is still empty. Why is this?

.

Adjust the undo tablespace's datafile to autoextend, and attempt to insert the contents of the ALL_OBJECTS view into the new table. This time, the insertion will succeed. Find out how many blocks of undo are needed to support the transaction so far by querying V$TRANSACTION as well as how big the new datafile is by querying V$DATAFILE.

.

Delete every row in the new table and then repeat the queries against V$TRANSACTION and V$DATAFILE.

You will see that the deletion generated many more blocks of undo and required a much larger extension of the undo

datafile than the insertion. Why is this?

.

Tidy up by switching back to the original undo tablespace and then dropping the test table and tablespace

.

(3) Include in the assignments all queries and their results that you execute in this part. Also include your answers to the questions written in italic thought the exercise.

Solutions

Expert Solution

1- creating undo table space- (I am taking random name- UNDO_TEST)-

create undo tablespace UNDO_TEST datafile '/path/to/your/dbf/file/xyz.dbf' size 200K;

Now, you can be use autoextend off manually to be reassured about it-

ALTER DATABASE DATAFILE /path/to/your/dbf/file/xyz.dbf' AUTOEXTEND OFF;

2- Now, let us set our new undo tablespace to use by database, we can switch between undo tablesspaces because this is a dynamic variable. Use below query to do this-

ALTER SYSTEM SET UNDO_TABLESPACE = UNDO_TEST;

Now, you can query DBA_ROLLBACK_SEGS to know about your rollback segments-

select segment_name, segment_id,status from DBA_ROLLBACK_SEGS;

3- Query-

create table undotest as select * from all_objects where 1=2;

4- insert into undotest select * from all_objects ;

5- This query will fail because we have set autoextend to off. If we set it on or we increase size then our query will run fine as it will get proper space to insert logs.

6- write a simple select query against both view to see the desired output-

select file,blocks,checkpoint_time,status from V$DATAFILE;

7- deletion will take more blocks than insertion for sure. Because if you want to insert something then undo action would be deletion, for that you only need to store rowid of record. But if you want to perform deletion then undo action will be insertion again, for that we need whole record. Hence deletion generates more number of blocks.

8- Use below command to switch back to original table space. After firing below command, wait until everything rollbacks properly. (note originalTS is just a reference, you can give from your database.)

Alter System SET Undo_Tablespace=originalTS;

drop table undotest; //to drop table

drop tablespace UNDO_TEST; //to delete table space


Related Solutions

For the following commands you must be logged in as user “system”. You will need to...
For the following commands you must be logged in as user “system”. You will need to do some research on the commands CREATE USER; GRANT CREATE SESSION; GRANT CREATE…..; GRANT ALTER …., GRANT SELECT….; REVOKE ……; and EXECUTE ….. 5. Create two database users:  The first is a concatenation of your first and last name (e.g. johndoe).  The second is a concatenation of your instructors first and last name (e.g. sallysmith) 6. Assign the two users privileges to...
n this assignment, you will need to code a Web page that will allow a user...
n this assignment, you will need to code a Web page that will allow a user to enter their first and last names and indicate how many pets they have, if any. If they have pets, the user will be able to list up to three of their names. You will code validations on some of the fields and display error messages on the page when a field does not pass the validation test. If all the data entered is...
Coding in C++: For this verse, you need to write a program that asks the user...
Coding in C++: For this verse, you need to write a program that asks the user to input the inventory id number (integer) and the price (float) for 5 inventory items. Once the 5 inventory items are input from the user, output the results to the screen. Please ensure you use meaningful names for your variables. If your variables are not named meaningfully, points will be deducted.
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with...
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with Grey coding and Eb/No = 0, 2, 4, 6, 8, 10 dB. Must provide MATLAB code.
11. Write a user oriented MATLAB program that will calculate the capacitance of the capacitor connected...
11. Write a user oriented MATLAB program that will calculate the capacitance of the capacitor connected across the loads to improve the overall power factor to 0.8 lagging,0.9 lagging, unity power factor, 0.8 leading, 0.9 leading. Also MATLAB will calculate total reactive, real power, and the total current at the source for each ste
I need some assistance with the following assignment: Cron is a system daemon running in the...
I need some assistance with the following assignment: Cron is a system daemon running in the background helping you schedule and execute tasks such as system backups. In this lab you will learn how to schedule backups with user and system cron tables. Submit a report that lists the commands that you would use to accomplish the following tasks: Check the status of a cron daemon Stop and terminate a cron daemon Start and run a cron daemon Restart a...
ou are headed to the mountains for some climbing this summer and you need some gear....
ou are headed to the mountains for some climbing this summer and you need some gear. The local mountaineering shop is offering 5% financing on all purchases before the end of the month. Your savings account is currently paying 6%, and you are in a marginal tax bracket of 28%. Which of the following is true (after taxes)? a. Borrow from the mountain shop — it is cheaper b. Take the money out of savings — it is cheaper c....
Define a problem with user input, user output, -> operator and destructors. C ++ please
Define a problem with user input, user output, -> operator and destructors. C ++ please
Need you to write an essay on an environmental problem and a solution to it. It...
Need you to write an essay on an environmental problem and a solution to it. It should be an observation.
Graphically solve the following problem. You need not show me the graph. However, you would need...
Graphically solve the following problem. You need not show me the graph. However, you would need to draw one to solve the problem correctly. You would need to indicate all the corner points clearly. Solve mathematically to identify the intersection points. Maximize profit = 8 x1 + 5x2    Subject to    x1 + x2 <=10 x1 <= 6 x1, x2 >= 0 a. What is the optimal solution? (You may utilize QM for Windows to answer b to d)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT