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...
This problem requires you to prompt the user for some information, and apply simple arithmetic operation...
This problem requires you to prompt the user for some information, and apply simple arithmetic operation to generate an output. We all know that driving is expensive. So let's write a program to observe this. Your job is to prompt the driver for miles per gallon and gas price (in dollars) per gallon You should prompt the user with the words: Enter miles per gallon: at which time the users enters a number, and then Enter the gas price:at which...
Assignment (C language) We will simulate the status of 8 LEDs that are connected to a...
Assignment (C language) We will simulate the status of 8 LEDs that are connected to a microcontroller. Assume that the state of each LED (ON or OFF) is determined by each of the bits (1 or 0) in an 8-bit register (high-speed memory). Declare a char variable called led_reg and initialize it to 0. Assume that the least-significant bit (lsb) controls LED#0 and the most-significant bit (msb) controls LED#7. In the main function, build and present a menu to the...
Define a java problem with user input, user output, Do While Statement and some mathematical computation....
Define a java problem with user input, user output, Do While Statement and some mathematical computation. Write the pseudocode, code and display output.
i need the pseudocode and python program for the following problem. Besides the user entering the...
i need the pseudocode and python program for the following problem. Besides the user entering the number of books purchased this order, they are asked for the number of points earned for the year before this order and the number of books ordered this year before this order. There are bonus points awarded based on the number of books previously ordered and number ordered now. These points should be added to the variable points: Current order: 0 Previous Orders >...
This is in java, thank you! Problem2: In this problem you ask the user for a...
This is in java, thank you! Problem2: In this problem you ask the user for a month and day. You will then calculate the season based on the month and day. Create a class named Problem2 Create two integer instance variables, month and day. Create a constructor to initialize the both variables. The constructor should accept two arguments as parameters, m and d. Initialize the instance variables with these two values. Create a method called calcSeason. It should not have...
1. Practice Tasks Aims: to simulate the principles and key technology in operating systems. You need...
1. Practice Tasks Aims: to simulate the principles and key technology in operating systems. You need to analyze, design, implement and debug a program which simulates the chosen principles or technology. You need to finish the following tasks to do the practice: 1) CPU scheduling algorithms (including FCFS, SJF, Priority Scheduling, Round Robin) 2) Process Synchronization (including producer and consumer problem, reader and writer problem, Dining-Philosophers Problem) 3) Page replacement algorithm (including FIFO, LRU, Optimal Algorithm) 4) Disk scheduling algorithm...
// JavaLanguage . You need to write a program that asks the user for an array...
// JavaLanguage . You need to write a program that asks the user for an array size, and then asks the user to enter that many integers. Your program will then print out the sum , average, largest and smallest of the values in the array.
I need to create a program that will simulate an ATM. The program has to be...
I need to create a program that will simulate an ATM. The program has to be written in JAVA that uses JOptionaPane to pop up the messages. It will need to simulate to get ** balance **withdraw **Deposit **exit the atm ** need to have a method that shows a receipt of everything that was done during the transaction
Problem 1: Simulating Blackjack In this problem we will use classes and functions to simulate a...
Problem 1: Simulating Blackjack In this problem we will use classes and functions to simulate a simplified game of Blackjack (21). The game begins with a standard deck of 52 playing cards (no jokers). Each player is dealt two cards to start with. The winner of a hand of Blackjack is the player whose hand has the highest value without going over 21. When calculating the value of a hand, we add up the rank of each card in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT