Sponsored Content
Top Forums Shell Programming and Scripting Automation script for Oracle queries for two different Databases Post 302969303 by vasuvv on Monday 21st of March 2016 10:12:44 AM
Old 03-21-2016
Automation script for Oracle queries for two different Databases

Hi Team,

I am Oracle Databse developer. I am currently working on two databases.

DB1 and DB2.

in DB1 I have a Select query which will return 100 records.

In Db2 I have a Select query which also return 100 records.

In these two tables ( in different Schemas) we have a common column.

Once after execution we will calculate the difference between these two columns.

After that we will send this result set to respective mail group.

This is the activity we will do manually 4th Tuesday of every month at 10AM CST.

Now I would like to automate this process using shell script. can any one please advise how to write the script for this process.

Many thanks.

Vasuv

Last edited by vasuvv; 03-21-2016 at 11:41 AM..
 

3 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Monitoring Tablespaces on Oracle Databases.

can anyone provide me with a basic command that can do this? like, is there a one liner command line i can run that will spit out some digits to me. (digits i can write a script to monitor)??? (0 Replies)
Discussion started by: SkySmart
0 Replies

2. Shell Programming and Scripting

script to find oracle databases that are not in cluster

I need to create a script to list all the databases that are in cluster environment. The reason is that there are databases which are not in under cluster control and we need to identify those. The easiest way to identify is: clrt list (if SUNW.oracle_server:6, SUNW.oracle_listener:5 are not... (0 Replies)
Discussion started by: misterx12345
0 Replies

3. Shell Programming and Scripting

Automation Script for Oracle

Hi, As a Oracle Developer, I am writing many Procedures,Functions and Packages. Facing Many optimization issue after writing these Database objects. Trying to tune it manually. Can we write any Shell/Perl/Python script to Optimize these Database objects instead of doing manual check and... (1 Reply)
Discussion started by: vasuvv
1 Replies
ANALYZE(7)							   SQL Commands 							ANALYZE(7)

NAME
ANALYZE - collect statistics about a database SYNOPSIS
ANALYZE [ VERBOSE ] [ table [ ( column [, ...] ) ] ] DESCRIPTION
ANALYZE collects statistics about the contents of tables in the database, and stores the results in the pg_statistic system catalog. Subse- quently, the query planner uses these statistics to help determine the most efficient execution plans for queries. With no parameter, ANALYZE examines every table in the current database. With a parameter, ANALYZE examines only that table. It is further possible to give a list of column names, in which case only the statistics for those columns are collected. PARAMETERS
VERBOSE Enables display of progress messages. table The name (possibly schema-qualified) of a specific table to analyze. Defaults to all tables in the current database. column The name of a specific column to analyze. Defaults to all columns. OUTPUTS
When VERBOSE is specified, ANALYZE emits progress messages to indicate which table is currently being processed. Various statistics about the tables are printed as well. NOTES
In the default PostgreSQL configuration, in the documentation takes care of automatic analyzing of tables when they are first loaded with data, and as they change throughout regular operation. When autovacuum is disabled, it is a good idea to run ANALYZE periodically, or just after making major changes in the contents of a table. Accurate statistics will help the planner to choose the most appropriate query plan, and thereby improve the speed of query processing. A common strategy is to run VACUUM [vacuum(7)] and ANALYZE once a day during a low-usage time of day. ANALYZE requires only a read lock on the target table, so it can run in parallel with other activity on the table. The statistics collected by ANALYZE usually include a list of some of the most common values in each column and a histogram showing the approximate data distribution in each column. One or both of these can be omitted if ANALYZE deems them uninteresting (for example, in a unique-key column, there are no common values) or if the column data type does not support the appropriate operators. There is more infor- mation about the statistics in in the documentation. For large tables, ANALYZE takes a random sample of the table contents, rather than examining every row. This allows even very large tables to be analyzed in a small amount of time. Note, however, that the statistics are only approximate, and will change slightly each time ANA- LYZE is run, even if the actual table contents did not change. This might result in small changes in the planner's estimated costs shown by EXPLAIN [explain(7)]. In rare situations, this non-determinism will cause the planner's choices of query plans to change after ANALYZE is run. To avoid this, raise the amount of statistics collected by ANALYZE, as described below. The extent of analysis can be controlled by adjusting the default_statistics_target configuration variable, or on a column-by-column basis by setting the per-column statistics target with ALTER TABLE ... ALTER COLUMN ... SET STATISTICS (see ALTER TABLE [alter_table(7)]). The target value sets the maximum number of entries in the most-common-value list and the maximum number of bins in the histogram. The default target value is 100, but this can be adjusted up or down to trade off accuracy of planner estimates against the time taken for ANALYZE and the amount of space occupied in pg_statistic. In particular, setting the statistics target to zero disables collection of statistics for that column. It might be useful to do that for columns that are never used as part of the WHERE, GROUP BY, or ORDER BY clauses of queries, since the planner will have no use for statistics on such columns. The largest statistics target among the columns being analyzed determines the number of table rows sampled to prepare the statistics. Increasing the target causes a proportional increase in the time and space needed to do ANALYZE. COMPATIBILITY
There is no ANALYZE statement in the SQL standard. SEE ALSO
VACUUM [vacuum(7)], vacuumdb [vacuumdb(1)], in the documentation, in the documentation SQL - Language Statements 2010-05-14 ANALYZE(7)
All times are GMT -4. The time now is 09:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy