In this topic , I am going to share the reviews of the software
"Treesize Professional".
This tool is a powerful and flexible hard disk space manager for Windows 8/7/Vista/XP or Windows Server 2012/2008/2003 (32 or 64
Bit).
This software lists the size of all the files within the folder
specified. This software displays the result in Gantt Chart as a easier visual
representation. This folder also does recursive search to scan the folders
inside the specified folder.
A
variety of graphic reports allow you to get large amounts of info about your
disk space at a glance.
The Chart tab, gives the pictorial representation of the sizes.
The 'Details' tab lists all the details of the folder within the search
directory including the % of Parent(allocated)
The 'extension' tab lists the size of the files grouped by extensions.
This will be helpful during analysis.
'Age of Files' tab has the details about the files grouped by the
creation date.
'Top 100 files' tab lists the top 100 files
grouped by size.
Pros:
Easier to understand the tool with the pictorial representation
Professional Interface
Graphical display
Can be integrated with
other apps like Scheduler to gather the stats every week.
Does
faster scan.
Require
no big Technical knowledge to use this tool.
Support
most of the 32/64 bit Windows Server.
Helpful
for weekly Server maintenance.
Cons:
Overpriced
Crowded Interface
Seems to freeze up with
large volumes of data. (1 terabyte).
Oracle tables which are very huge say(> 2GB) , which inserts data
everyday and that have historical and important details for reference, requires
Partitions.
Partitions are nothing but smaller segments within the tables for
easier maintenance of the tables.
When the content of a table need to be distributed across different types of storage devices, then we need to create partitions.
And finally for performance issue, we need partition. We prefer losing
a weekly data instead of the whole table contents :)
Partitioned Index:
In addition to partitioning not only the tables, the Primary keys of
the big tables are partitioned as well:
The reasons for partitioning the index are:
Avoid
rebuilding the entire index when data is removed.
Perform
maintenance on parts of the data without invalidating the entire index.
Reduce
the impact of index skew caused by an index on a column with a
monotonically increasing value.
Partitions can be created weekly or monthly basis depending of the data
inflow:
We can create a dbms_job for creating the weekly(or monthly)
partitions. The sample statement for creating partition name is :
We create the below table to show the demonstration about partition:
This sql will create the name of the partition in the format
"201545_20151107". This means, that the partition has been created
for the week no 45 of the year 2015 and the week ending 07.11.2015. This way
you can create a job to create 3 partition names every week. This job can be
scheduled to run every Sunday.
Once the names of the partition are created,then we need to create
partition in the big tables with the created names.
For example if the table name is TBL_PERSONINFORMATION then partition
names can be created as "TBL_PI_201545_20151107".
Table creation script:
CREATE TABLE TBL_PERSONALINFORMATION
(
PERSONID VARCHAR2(20 CHAR) NOT NULL,
FORENAME VARCHAR2(1000 CHAR),
LASTNAME VARCHAR2(1000 CHAR) NOT NULL,
AGE NUMBER,
SEX VARCHAR2(1 BYTE),
ADDRESS VARCHAR2(2000 CHAR),
DATE_ADDED DATE
)
PARTITION BY RANGE (DATE_ADDED)
(
PARTITION
TBL_PI_201543_20151024 VALUES LESS THAN (TO_DATE(' 2015-10-25 00:00:00',
'YYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) ,
PARTITION
TBL_PI_201544_20151024 VALUES LESS THAN (TO_DATE(' 2015-11-01 00:00:00',
'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) ,
PARTITION
TBL_PI_201545_20151024 VALUES LESS THAN (TO_DATE(' 2015-11-07 00:00:00',
'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
);
Inserting data into the table:
insert into TBL_PERSONALINFORMATION partition (TBL_PI_201543_20151024)
values ('10','AA','BB',19,'F','AAA BBB St.',sysdate);
After inserting into the table at the appropriate partition, the table
looks like below:
Each partition has sufficient number of rows for our demo.
Before deleting Partition:
Few important points to consider before deleting the partitions:
All the
FKs must be disabled before deleting
Delete
the partitions using 'ALTER TABLE.. DROP PARTITION' syntax
Enable
the FKs back
Rebuild
the indexes of the partitioned table
Delete
the data from the referential tables to maintain consistency.
Deleting the Partition:
This way, I have deleted the partition
"TBL_PI_201543_20151024".
Quiz Time
Do you know why we disable Foreign Keys before deleting Partitions?
Tablespace is created in oracle for allocating space for holding
database objects.
There are different types of tablespaces:
PERMANENT TABLESPACE: This tablespace contains
persistent schema objects.Objects in permanent
tablespaces are stored indatafiles.
AnUNDO tablespaceis a type of permanent
tablespace used by Oracle Database to manage undo data if you are running
your database in automatic undo management mode. Oracle strongly
recommends that you use automatic undo management mode rather than using
rollback segments for undo.
ATEMPORARY TABLESPACEcontains schema objects only
for the duration of a session. Objects in temporary tablespaces are stored
in tempfiles.
CREATE TABLESPACE
Tablespaces are created with the syntax 'CREATE
TABLESPACE'.
Project Tablespace:
In any oracle related project, tablespaces can be
created as below:
<PROJECT>_BIG_IDX:
All the small Indexes,
Index Partitions of size greater than 4 MB are grouped here. INDEXPARTITITON comes under this.
<PROJECT>_SMALL_IDX:
All the small Indexes,
Index Partitions of size lesser than 5 MB are grouped here. INDEXPARTITITON comes under this.
<PROJECT>_BIG_TAB:
All the database objects
like LOBINDEX, LOBSEGMENT, TABLE, TABLEPARTITON etc. of size greater than 5 MB
are grouped here.
<PROJECT>_SMALL_TAB:
All the database objects
like LOBINDEX, LOBSEGMENT, TABLE, TABLEPARTITON etc. of size lesser than 5 MB
are grouped here.
Re-allocating the database objects in proper
tablespaces:
There are cases where we need to reallocate database
objects like Tables, Index in the proper Tablespaces on weekly or on monthly
basis.
These reallocation will be done
based on num_rows,
avg_row_len and initial_extent of the Table objects.
Manual Tablespace reallocation scripts:
Table:
ALTER TABLE <TABLE NAME to be moved> MOVE TABLESPACE
<destination TABLESPACE NAME>;
Index:
ALTER INDEX <INDEX_NAME> REBUILD TABLESPACE
<TABLESPACE_NAME>;
LOBSEGMENT:
In Order to move CLOB column to different tablespace, use the below
command. This will move LOGSEGMENT and LOBINDEX to the new tablespace.
ALTER TABLE <Table_Name> MOVE LOB(<CLOB_Column>) STORE AS
(TABLESPACE <Tablespace_name>);
LOBINDEX:
You cannot specify a tablespace for the LOBINDEX -- it is automatically
created and moved with the LOBSEGMENT.
TABLE PARTITION:
alter table <table_name> move partition
<Table_partition_name> tablespace <tablespace_name>;
INDEX PARTITION:
ALTER INDEX <Index_name> REBUILD PARITION <Partition_Name>
TABLESPACE <Tablespace_name>;
The below queries will identify the locked sessions, the owner of the locked objects.
This also explains how to kill the blocking locked sessions.
--Active sessions select substr(a.spid,1,9) pid, substr(b.sid,1,5) sid, substr(b.serial#,1,5) ser#, substr(b.machine,1,6) box, substr(b.username,1,10) username, -- b.server, substr(b.osuser,1,8) os_user, substr(b.program,1,30) program from v$session b, v$process a where b.paddr = a.addr and type='USER' order by os_user,username;
-- Query to identify the locks SELECT username U_NAME, owner OBJ_OWNER, object_name, object_type, s.osuser, DECODE(l.block, 0, 'Not Blocking', 1, 'Blocking', 2, 'Global') STATUS, DECODE(v.locked_mode, 0, 'None', 1, 'Null', 2, 'Row-S (SS)', 3, 'Row-X (SX)', 4, 'Share', 5, 'S/Row-X (SSX)', 6, 'Exclusive', TO_CHAR(lmode) ) MODE_HELD FROM gv$locked_object v, dba_objects d, gv$lock l, gv$session s WHERE v.object_id = d.object_id AND (v.object_id = l.id1) AND v.session_id = s.sid ORDER BY username, session_id;
--Identify the locks of the owner
SELECT * FROM DBA_DML_LOCKS where owner=<owner_name>;
--Use this session id to find SERIAL# by using following SELECT statement SELECT SID,SERIAL# FROM V$SESSION WHERE SID IN (SELECT SESSION_ID FROM DBA_DML_LOCKS where owner=<owner_name>);
--Use ALTER SYSTEM command to KILL SESSION and this will release the lock: ALTER SYSTEM KILL SESSION '152,361'; In order to execute this, you may need Oracle DBA previlieges. Check with your DBA to execute this step.
The below is the function to convert BLOB to CLOB datatypes. Before going to the function, lets understand what are those datatypes about:
BLOB data type
A BLOB (binary large object) is a varying-length binary string that can be up to 2,147,483,647 characters long. Like other binary types, BLOB strings are not associated with a code page. In addition, BLOB strings do not hold character data. The length is given in bytes for BLOB unless one of the suffixes K, M, or G is given, relating to the multiples of 1024, 1024*1024, 1024*1024*1024 respectively.
A CLOB (character large object) value can be up to 2,147,483,647 characters long. A CLOB is used to store unicode character-based data, such as large documents in any character set. The length is given in number characters for both CLOB, unless one of the suffixes K, M, or G is given, relating to the multiples of 1024, 1024*1024, 1024*1024*1024 respectively. Length is specified in characters (unicode) for CLOB.