xargs foo helps a lot for running parallel operation..
This is the example , how we can rebuild indexes parallel on postgres
cat create_index.sql | xargs -d “n” -L1 -P10 -I _CREATE_ psql -qAt -U postgres -p 5432 -d pagila -c “_CREATE_”
xargs foo helps a lot for running parallel operation..
This is the example , how we can rebuild indexes parallel on postgres
cat create_index.sql | xargs -d “n” -L1 -P10 -I _CREATE_ psql -qAt -U postgres -p 5432 -d pagila -c “_CREATE_”
One of the key features any enterprise considers when choosing a database technology for their architecture solution stack is that of replication. Oracle and MySQL both have built in replication solutions, but as of yet PostgreSQL doesn’t support a built in replication solution. There are many replication solutions available however, and different companies are using different solutions customized for their needs.
Among all of the solutions, Slony is probably the most widely tested and deployed within organizations, although it does have the following limitations:
One new alternative to Slony is a project known as RubyRep, which is designed to avoid some of the limitations of Slony. RubyRep provides both master-slave and master-master replication, and it works for PostgreSQL as well as MySQL. It is currently developed by Arndt Lehmann, a German who has been living since 2001 in Tokyo, Japan. He also provides great support to the RubyRep mailing list, especially for adding new features or fixing bugs.
RubyRep always operates on two databases. To make it simple to understand, the databases are referred to as “left” and “right” database respectively.
RubyRep’s key features includes:
In addition to the above, RubyRep actually provides three tools in one; a Compare, Sync, and Replication tools.
This tool scans corresponding tables of left and right database, looking for diverging data. Key features of the comparison tool are:
In one test we ran, we compared two 50 million row tables in around 3 hours, without affecting production server load. This is accomplished by comparing rows in batches, and you can adjust the batch size in the configuration file.
The sync tool is used to synchronize data in corresponding tables of a left and right pair of databases. Key features of the sync tool are:
Of course RubyRep also provides a replication tool. Some of the key features of the replication tool include:
One of the problems common to replication solutions is that of setting up new nodes. With Slony, there are always some headaches caused by high load on master database server, as a result of the TRUNCATE/COPY cycle Slony goes through. In the case of RubyRep, most of the CPU load is on the slave server, and you can use the Sync command in advance before you start replicating database. RubyRep also provides some flexibility to ignore the Sync commands if you don’t want to sync the database again.
; ./rubyrep --help
Usage: ./bin/rubyrep [general options] command [parameters, ...]
Asynchronous master-master replication of relational databases.
Available options:
--verbose Show errors with full stack trace
-v, --version Show version information.
--help Show this message
Available commands:
generate Generates a configuration file template
help Shows detailed help for the specified command
proxy Proxies connections from rubyrep commands to the database
replicate Starts a replication process
scan Scans for differing records between databases
sync Syncs records between databases
uninstall Removes all rubyrep tables, triggers, etc. from "left" and "right" database
; ./rubyrep generate pagila.conf
; cat pagila.conf
RR::Initializer::run do |config|
config.left = {
:adapter => 'postgresql', # or 'mysql'
:database => 'pagila,
:username => 'rubyrep',
:password => 'rubyrep',
:host => '192.168.0.1',
:port =>'5432'
}
config.right = {
:adapter => 'postgresql',
:database => 'pagila',
:username => 'rubyrep',
:password => 'rubyrep',
:host => '127,0.0.1',
:port => '5483'
}
config.include_tables 'users'
# config.include_tables /^e/ # regexp matching all tables starting with e
# config.include_tables /./ # regexp matching all tables in the database
end
; ./rubyrep scan -d=keys -b -c pagila.conf > users_diff.log
; cat users_diff.log
users users ......................... 1
---
:conflict:
- lastname: patel
zipcode: "2096"
ipaddress: 192.168.0.126
userid: 48212620
address: columbia
; ./rubyrep sync -c pagila.conf
By default, RubyRep runs in master-master replication mode, but you can adjust the following configuration setting to make it master-slave replication:
; cat pagila_replicate.conf
RR::Initializer::run do |config|
config.left = {
:adapter => 'postgresql',
:database => 'pagila,
:username => 'rubyrep',
:password => 'rubyrep',
:host => '192.168.0.1',
:port =>'5432',
:schema_search_path => 'public,pagila'
}
config.right = {
:adapter => 'postgresql',
:database => 'pagila',
:username => 'rubyrep',
:password => 'rubyrep',
:host => '127,0.0.1',
:port => '5483',
:schema_search_path => 'public,pagila'
}
config.include_tables /./ # regexp matching all tables in the database
config.options[:auto_key_limit] = 60
config.options[:adjust_sequences] = false
config.options[:sequence_increment] = 1
#Sync Policy: Changes in the right database will not be applied to the left database.
config.options[:right_record_handling] = :ignore
config.options[:sync_conflict_handling] = :left_wins
# Additional logging
config.options[:logged_replication_events] = [
:ignored_changes,
:ignored_conflicts
]
#ignore history tables
config.exclude_tables /_history/
config.exclude_tables 'test1'
config.exclude_tables 'pagila'
end
Detailed information for the each configuration setting can be found in the RubyRep documentation. There are also sample configuration files and a tutorial available too for getting familiar with each of the features RubyRep offers. Based on our initial testing, it should also be possible to upgrade some older PostgreSQL databases from 8.2 to 8.4.
At OmniTi, we support various databases i.e oracle,postgresql,mysql etc.. Most of the databases are on Solaris servers. Solaris has many cool features for easy database management, one of them is SMF services.
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='database/oracle' type='service' version='0'>
<create_default_instance enabled='false'/>
<single_instance/>
<dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency name='network-service' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/service'/>
</dependency>
<dependency name='name-services' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/name-services'/>
</dependency>
<dependency name='identity' grouping='optional_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/identity:domain'/>
</dependency>
<dependency name='system-log' grouping='optional_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/system-log'/>
</dependency>
<dependency name='autofs' grouping='optional_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/autofs'/>
</dependency>
<method_context project=':default' resource_pool=':default' working_directory=':default'>
<method_credential group='oinstall' limit_privileges=':default' privileges=':default' supp_groups=':default' user='oracle'/>
<method_environment>
<envvar name='TNS_ADMIN' value='/opt/app/oracle/network/admin'/>
<envvar name='ORACLE_SID' value='TEST'/>
<envvar name='ORACLE_BASE' value='/opt/app/oracle'/>
<envvar name='ORACLE_HOME' value='/opt/app/oracle/102'/>
<envvar name='LD_LIBRARY_PATH' value='/opt/app/oracle/102/lib'/>
<envvar name='PFILE' value='/opt/app/oracle/admin/TEST/pfile/initTEST.ora'/>
</method_environment>
</method_context>
<exec_method name='start' type='method' exec='$ORACLE_HOME/bin/sqlplus @/export/home/oracle/smf/startup.sql' timeout_seconds='500'>
<method_context/>
</exec_method>
<exec_method name='stop' type='method' exec='$ORACLE_HOME/bin/sqlplus @/export/home/oracle/smf/shutdown.sql' timeout_seconds='900'>
<method_context/>
</exec_method>
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring' value='oracle.smf.manage.oracle'/>
</property_group>
<property_group name='dependents' type='framework'>
<propval name='db-oracle_multi-user' type='fmri' value='svc:/milestone/multi-user'/>
</property_group>
<property_group name='startd' type='framework'>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>Oracle Database Server</loctext>
</common_name>
</template>
</service>
</service_bundle>
<?xml version='1.0'?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <service_bundle type='manifest' name='export'> <service name='database/oralistener' type='service' version='0'> <create_default_instance enabled='false'/> <single_instance/> <dependency name='fs-local' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/system/filesystem/local'/> </dependency> <dependency name='network-service' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/network/service'/> </dependency> <dependency name='name-services' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/milestone/name-services'/> </dependency> <dependency name='identity' grouping='optional_all' restart_on='none' type='service'> <service_fmri value='svc:/system/identity:domain'/> </dependency> <dependency name='system-log' grouping='optional_all' restart_on='none' type='service'> <service_fmri value='svc:/system/system-log'/> </dependency> <dependency name='autofs' grouping='optional_all' restart_on='none' type='service'> <service_fmri value='svc:/system/filesystem/autofs'/> </dependency> <method_context project=':default' resource_pool=':default' working_directory=':default'> <method_credential group='oinstall' limit_privileges=':default' privileges=':default' supp_groups=':default' user='oracle'/> <method_environment> <envvar name='TNS_ADMIN' value='/opt/app/oracle/network/admin'/> <envvar name='ORACLE_SID' value='TEST'/> <envvar name='ORACLE_BASE' value='/opt/app/oracle'/> <envvar name='ORACLE_HOME' value='/opt/app/oracle/102'/> <envvar name='LD_LIBRARY_PATH' value='/opt/app/oracle/102/lib'/> </method_environment> </method_context> <exec_method name='start' type='method' exec='$ORACLE_HOME/bin/lsnrctl start LISTENER' timeout_seconds='50'> <method_context/> </exec_method> <exec_method name='stop' type='method' exec='/home/oracle/smf/stop_listener.sh' timeout_seconds='50'> <method_context/> </exec_method> <property_group name='general' type='framework'> <propval name='action_authorization' type='astring' value='oralistener.smf.manage.oralistener'/> </property_group> <property_group name='dependents' type='framework'> <propval name='db-oracle_multi-user' type='fmri' value='svc:/milestone/multi-user'/> </property_group> <property_group name='startd' type='framework'> <propval name='ignore_error' type='astring' value='core,signal'/> </property_group> <stability value='Unstable'/> <template> <common_name> <loctext xml:lang='C'>Oracle Database Listener</loctext> </common_name> </template> </service> </service_bundle>
I have been reading postgresql 8.4 new features since 6 months .These are some of the links useful to learn postgres8.4 cool features …
Friends,
I have not posted blong since long time. I was busy with my personal problems and applying for MBA @ Carey Business school of Johns Hopkins University.
Waiting on the admission decision…will post the positive update soon!!
Movies:
Online TV:
DISCLAIMER: Links are not sponsored by me or i don’t give any guarantee that it will work.
Hello Guys,
Sorry i did not post since July. I am back now with new thoughts !!
I am Core Oracle DBA. But I got fever to become Oracle Apps DBA.
What’s the best place to learn online FREE?
I found very good blog site…
http://onlineappsdba.com/index.php/2006/07/29/how-2-become-oracle-apps-dba/
I will keep posting as i will start reading the manuals.
check back next time to learn more about Oracle Apps DBA skills!!
start off with oracle application architecture..
Wow!!
It’s free seminar for full day on MySQL for Oracle DBA!!
Check it out on MySql website to free registration.
Location and details:
Date: Tues Aug 14, 2007
Time: 8am-6pm
Location:
The Westin New York at Times Square
270 West 43rd Street
New York, NY 10036
Phone: 212-201-2700
Fax: 212-201-2701
Reservations: 866-837-4183
I am going to attend . If you are , see you there!!
Hello Everyone,
I feel that i should start my own blog after reading lots of blogs for professional and personal!!!
So..i am here with my first blog. Let me introduce myself.
Name : Denish Patel
Occupation: Oracle database Analyst @ OmniTi Inc, Columbia,MD
Looking forward to post 2-3 posts in a month!! Let’s see.