Thursday, November 3, 2011

Crontab entry to generate an output file with 'date' format...


No time to blog too much on this.

Here is the simple change that I wanted from crontab.

Instead of writing the log into one file (appending) every time the crontab is initiated (and you know how big the file is going to be after few days/weeks/months) I decided to write into its own file with the Date and Time attached to the file name.

Original crontab entry with a file being appended with the results:

00 15 * * 1-6 /home/san/test.sh >> /home/san/test.log

So, changed to below to have the date and time part appended to the file name instead:

00 15 * * 1-6 /home/san/test.sh > /home/san/test.crontab.log.`date +%d.%m.%y.%R`

Damn thing wont work... No file is generated...

what the hell... that part of the date portion is correct and sure thing works fine in shell script...

Well, found that % is also treated as "comment" in crontab so gottaa escape that character with backslash to make it work.

Here is the correct entry:

00 15 * * 1-6 /home/san/test.sh > /home/san/test.crontab.log.`date +\%d.\%m.\%y.\%R`

Now, there is a file that gets created with the date format that I wanted...

Saturday, August 27, 2011

Maximum datafile size limits...

Max. Number of Data Files in 9i and 10g is limited to 65,536.

Max. Number of blocks in a data file is:
4,194,304 (4 million) in 9i and increased to
4,294,967,296 (4 billions) in 10g when used BIGFILE Tablespace.

How to calcualte Max.Datafile Size:

Max.DataFile Size = db_block_size * Max. Number of Blocks

How to calculate Max.Database Size:

Max.Data file Size * Max. Number of Datafiles.
Here is the chart with SMALLFILE Tablespace (using 4 million blocks):

Block Size Max. Data File Size Max. Database Size
32 K 128 GB 8,388,608 GB
16 K 64 GB 4,194,304 GB
8 K 32 GB 2,097,152 GB
4 K 16 GB 1,048,579 GB
2 K 8 GB 524,288 GB


Here is the chart with BIGFILE Tablesapce (using 4 million blocks):

Block Size Max. Data File Size Max. Database Size
32 K 131,072 GB (128T) 8,589,934,592 GB
16 K 65,536 GB (64T) 4,294,967,296 GB
8 K 32,768 GB (32T) 2,147,483,648 GB
4 K 16,384 GB (16T) 1,073,741,824 GB
2 K 8,192 GB (8T) 536,870,912 GB

The maximum amount of data for a 32K block size database is eight exabytes (8,388,608 Terabytes) in Oracle 10g.

Note:
The BIGFILE syntax must be specified during the tablespace creation as such:
CREATE BIGFILE TABLESPACE my_ts;

The BIGFILE tablespace can ONLY have a SINGLE datafile.
By creating a tablespace using this syntax, Oracle increases the maximum number of blocks in a datafile from the 4 Million blocks to a maximum of 4 Billion.

Wednesday, August 24, 2011

Parallel Execution on the same node where it started in RAC




By default, in an Oracle RAC environment, a SQL statement executed in parallel can run across all of the nodes in the cluster. For this cross-node or inter-node parallel execution to perform, the interconnection in the Oracle RAC environment must be size appropriately because inter-node parallel execution may result in a lot of interconnect traffic. If the interconnection has a considerably lower bandwidth in comparison to the I/O bandwidth from the server to the storage subsystem, it may be better to restrict the parallel execution to a single node or to a limited number of nodes. Inter-node parallel execution does not scale with an undersized interconnection.

10g:
Utilize the parameters instance_group and parallel_instance_group to limit this execution to particular node.

ex.,
Instance#1 parameter:
instance_groups='pqgrp1','pqallnodes';
Instance#2 parameter:
instance_groups='pqgrp2','pqallnodes';

Now, While running the batch process or any program that needs to be executed in only one instance then:
alter session set parallel_instance_group = 'pqgrp1'; -- This will make the following program executions to be used only Instance#1.

11g on-wards:
To limit inter-node parallel execution, you can control parallel execution in an Oracle RAC environment using the PARALLEL_FORCE_LOCAL initialization parameter. By setting this parameter to TRUE, the parallel server processes can only execute on the same Oracle RAC node where the SQL statement was started.