0% found this document useful (0 votes)
76 views7 pages

What Is Undo?

- Oracle maintains undo records to rollback or undo changes to the database. These records can be used to rollback transactions, recover the database, and maintain read consistency. - By default, Oracle uses automatic undo management mode where it automatically creates and manages undo data in undo tablespaces. The undo_retention parameter specifies how long undo data is retained for queries. - Undo tablespaces can be created, altered, and dropped. The undo_tablespace parameter specifies which tablespace is active for undo management. Tablespaces can be taken offline and online as needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views7 pages

What Is Undo?

- Oracle maintains undo records to rollback or undo changes to the database. These records can be used to rollback transactions, recover the database, and maintain read consistency. - By default, Oracle uses automatic undo management mode where it automatically creates and manages undo data in undo tablespaces. The undo_retention parameter specifies how long undo data is retained for queries. - Undo tablespaces can be created, altered, and dropped. The undo_tablespace parameter specifies which tablespace is active for undo management. Tablespaces can be taken offline and online as needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

What is undo?

-Oracle database maintaining the information  that is used to rollback or


undo the changes to the database and it keeps the transaction record before
they  are  committed  .

-Oracle needs this information to rollback or undo the changes to the


database.

-These records are called rollback or undo records

Uses

*Rollback transactions - rollback the  uncommitted transactions

*Recover the database - during database recovery undo records are used to
undo to uncommitted transactions are applied from redolog to datafiles

*Read consistency

*Recover from logical corruption using flashback features

-It  was introduced from  oracle 9i before that  previous versions "rollback
segments"  to manage undo

Types of undo management

(Note:Oracle strongly recommends that you use undo tablespace  to


manage undo rather that rollback segments)
 

Automatic Undo management Mode:

In initialization parameter to  UNDO_MANAGEMENT=AUTO  while starts db


its automatic undo management mode.By default it is in manual  undo
management mode  undo_tablespace

-It's  a optional dynamic parameter,can be change online -By default this


tablespace is created on database creation

-by mentioned this  tablespace is undo_tablespace=undotbs to find out all 


undo tablespace

SQL> select tablespace_name, contents from dba_tablespaces where contents =


'UNDO';

to view current undo

SQL> show parameter undo_tablespace

or

SQL> select VALUE from v$parameter where NAME='undo_tablespace';


UNDO_RETENTION is a parameter in the init.ora initialization parameters file
that specifies the time period in seconds for which a system retains undo
data for committed transactions. 

The flashback query can go upto the point of time specified as a


value in the UNDO_RETENTION parameter.

we can see in parameter file

UNDO_RETENTION=900

Here by default value is 900 calculation of undo_retention size

undo_retention=Actual Undo Size / (DB_BLOCK_SIZE × UNDO_BLOCK_REP_ESC)

to change the undo_retention

SQL> alter system set UNDO_RETENTION=2400;

The effect of the UNDO_RETENTION parameter is immediate, but it can only


be honored if the current undo tablespace has enough space.

If an active transaction requires undo space and the undo tablespace does
not have available space, then the system starts reusing unexpired undo
space (if retention is not guaranteed).

This action can potentially cause some queries to fail with the ORA-01555
"snapshot too old" error message.

Create undo tablespace

SQL> CREATE UNDO TABLESPACE undotbs_02 DATAFILE


'$ORACLE_BASE/oradata/TEST/undo02.dbf' SIZE 2M REUSE AUTOEXTEND ON RETENTION
NOGUARANTEE;

Note: we can create more than one undo tablespace but only one 
can active at one time

Alter undo tablespace

SQL> ALTER UNDO TABLESPACE undotbs_02 ADD DATAFILE


'$ORACLE_BASE/oradata/TEST/undo02.dbf' SIZE 2M REUSE AUTOEXTEND ON NEXT 1M
MAXSIZE UNLIMITED;

 Rename datafile

SQL>Alter database RENAME FILE 'old_full_path' TO 'new_full_path';


Offline / Online datafile

SQL> ALTER TABLESPACE undotbs offline;


SQL> ALTER TABLESPACE undotbs online;

Dropping Undo Tablespace

SQL>Drop tablespace undots1;

Switching Undo Tablespaces

SQL> Alter SYSTEM SET UNDO_TABLESPACE = undotbs_02;

 To view space information


 
    1) V$UNDOSTAT - Estimate the current over load
    2) V$ROLLSTAT -  For automatic undo management mode
   3) V$TRANSACTION -  Contains undo segment information
   4) DBA_UNDO_EXTENTS - Shows the status and size of each extent in the
undo tablespace
   5)WRH$_UNDOSTAT -  Contains statistical snapshots of V$UNDOSTAT
information
   6)WRH$_ROLLSTAT - Contains statistical snapshots of V$ROLLSTAT
information
 
Undo segments in the database
 
SQL> select segment_name, tablespace_name from dba_rollback_segs;

Netowrking

networking in oracle 11g

why we need  network?

The network is used to establish connection between two servers here i


made two set up on vmware
 i.e primary,standby

-Upto Version5 it supported only host based computing(using  dump


terminals) (Both  application and DB resides on the same server)

-From version6 it started supporting client/server computing (client & server


are connected via LAN)

-From oracle8i  it supported browser based technology (java is supported at


oracle kernel level).Java pool is added SGA

-From  version6 through  8i it supporting following protocol I)TCP/IP


II)IPx/SPx  (Novels protocol) III)NetBUEI (Microsoft protocol)

-From oracle9i it only supports TCP/IP as it became industries standard


protocol  

Server Side Configuration:


-At the time of oracle installation,we  need to choose oracle network protocol
adapter for TCP/IP protocol -We need to define listener in
$ORACLE_HOME/network/admin/listner.ora(ASCII file)

-While defining the listener are we  need to mention

I)listener name

II) List of SIDs

III)Protocol (TCP/IP) IV)Port number (1521 is default)

-listner always supports multiple instances but must user 'unique' port 
numbers

   

Online TS relocate
we discuss about how to relocate tablespace ?

S-1: check the tablespace available on database

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
-------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
EXAMPLE
B

here i m going to relocate the tablespace "B" from one place into another

S-2: To view the datafile location

SQL> select file_name from dba_data_files where tablespace_name='B';

FILE_NAME
----------------------------
/u01/app/oracle/product/11.2.0.3/oradata/TEST/b.dbf

S-3: take the tablespace offline before we ll do relocate

SQL> alter tablespace B offline;

Tablespace altered.
S-4:

[oracle@oracle11g ~]$ cd /u02


[oracle@oracle11g u02]mkdir test
[oracle@oracle11g u02] cd test
[oracle@oracle11g test]mv /u01/app/oracle/product/11.2.0.3/oradata/b.dbf
/u02/test/b.dbf

S-5:

alter tablespace b rename datafile


'/u01/app/oracle/product/11.2.0.3/oradta/b.dbf' ro '/u02/test/b.dbf';

S-6:

SQL>alter tablespace b online;

S-7:

SQL>select file_name from dba_data_files where tablespace_name= 'B';

in these method tablespace has been relocated during database is running

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy