Sybase Blog -Anything About Sybase ASE,REP,IQ.

Showing posts with label Sybase ASE/REP Interview Questions. Show all posts
Showing posts with label Sybase ASE/REP Interview Questions. Show all posts

Thursday, March 24, 2011

Installing the jconnect for Sybase ASE.

1. Install the Java Runtime environment or Install the JDK from www.java.com

2. Set the PATH environment variable for Java compiler and interpreter as

PATH=.:$PATH:"/bin"
export PATH

3. Download the jconnect(Sybase Driver) from Sybase and untar/unzip the package from http://www.sybase.com/products/middleware/jconnectforjdbc

4. You need to define two env variable CLASSPATH & JDBC_HOME

i)Set the JDBC_HOME as
[sybase@localhost jConnect-6_0]$ JDBC_HOME="/home/sybase/15.5/jConnect-6_0"
[sybase@localhost jConnect-6_0]$ export JDBC_HOME
[sybase@localhost jConnect-6_0]$ echo $JDBC_HOME
/home/sybase/15.5/jConnect-6_0

ii) Set the CLASSPATH as
[sybase@localhost jConnect-6_0]$CLASSPATH="$JDBC_HOME/classes":"/home/sybase/15.5/jConnect-6_0/classes/jconn3.jar ":.
[sybase@localhost jConnect-6_0]$ export CLASSPATH
[sybase@localhost jConnect-6_0]$ echo $CLASSPATH
.:/home/sybase/15.5/jConnect-6_0/classes/jconn3.jar:/home/sybase/15.5/jConnect-6_0/classes

5. Install the Jconnect stored procs and tables :

For jConnect to function properly, you must install stored procedures and tables on the Adaptive Server Enterprise or ASA.

Go the $JDBC_HOME/classes
java IsqlApp -U sa -P -S jdbc:sybase:Tds:localhost.localdomain:5000 -I $JDBC_HOME/sp/sql_server15.0.sql -c go

6. If installation is successful, you need to test the installation

For testing you can check using following Applet : run from $JDBC_HOME
java sample2.SybSample Version
If everything is fine, you can get the jconnect version in output window.

7. Testing Java connectivity with Sybase ASE
[sybase@localhost ~]$ cat JdbcTest.java
import java.sql.* ;
public class JdbcTest
{
public static void main( String args[] )
{
try
{
Class.forName( "com.sybase.jdbc3.jdbc.SybDriver" ) ;
Connection conn = DriverManager.getConnection( "jdbc:sybase:Tds:localhost.localdomain:5000", "sa", "") ;
Statement stmt = conn.createStatement() ;
ResultSet rs = stmt.executeQuery( "SELECT * FROM master..sysdatabases" ) ;
while( rs.next() )
System.out.println( rs.getString(1) ) ;
rs.close() ;
stmt.close() ;
conn.close() ;
}
catch( Exception e )
{ System.out.println( e ) ; }
}
}


i)Compile the code
[sybase@localhost ~]$ javac JdbcTest.java


ii)Test your code
[sybase@localhost ~]$ java JdbcTest
master
model
tempdb
sybsystemdb
sybsystemprocs
pubs2
sybsecurity

Friday, March 11, 2011

ASE Archive Databases for Compressed Backup.

Observation:

1. For compressed backup , only works with option : with compression=""

2. If we have taken the backup with with compression="" option, we no need to specify the the compression level during load database.

3. We can perform the dbcc on recent dump files of the databases, without hampering the performance of the prodduction database.

4. We can also object level recovery using the Archive Database.

5. For mapping the dump stipes , it makes sysaltusages table in scratch database.

Testing:

1> dump database test_db to "/data/sybase/testing_host/dump/test_db.dmp1"
2> stripe on "/data/sybase/testing_host/dump/test_db.dmp2" with compression="4"
3> go
Backup Server session id is: 131. Use this value when executing the 'sp_volchanged' system stored procedure after fulfilling any
volume change request from the Backup Server.
Backup Server: 4.41.1.1: Creating new disk file /data/sybase/testing_host/dump/test_db.dmp1.
Backup Server: 4.41.1.1: Creating new disk file /data/sybase/testing_host/dump/test_db.dmp2.
Backup Server: 6.28.1.1: Dumpfile name 'sr_load1106806A97' section number 1 mounted on disk file
'/data/sybase/testing_host/dump/test_db.dmp2'
Backup Server: 6.28.1.1: Dumpfile name 'sr_load1106806A97' section number 1 mounted on disk file
'/data/sybase/testing_host/dump/test_db.dmp1'
Backup Server: 4.188.1.1: Database test_db: 11960 kilobytes (4%) DUMPED.
Backup Server: 4.188.1.1: Database test_db: 29094 kilobytes (6%) DUMPED.
Backup Server: 4.188.1.1: Database test_db: 315648 kilobytes (100%) DUMPED.
Backup Server: 4.188.1.1: Database test_db: 323870 kilobytes (100%) DUMPED.
Backup Server: 3.43.1.1: Dump phase number 1 completed.
Backup Server: 3.43.1.1: Dump phase number 2 completed.
Backup Server: 3.43.1.1: Dump phase number 3 completed.
Backup Server: 4.188.1.1: Database test_db: 323884 kilobytes (100%) DUMPED.
Backup Server: 3.42.1.1: DUMP is complete (database test_db).
1> !!ls -ltr /data/sybase/testing_host/dump/test_db.dmp*
[sh:ls -ltr /data/sybase/testing_host/dump/test_db.dmp*]
-rw-r----- 1 sybase dba 40783872 Mar 9 07:35 /data/sybase/testing_host/dump/test_db.dmp1
-rw-r----- 1 sybase dba 41261056 Mar 9 07:35 /data/sybase/testing_host/dump/test_db.dmp2


1> create database scratch on data16='100M' log on log01='100M'
2> go
CREATE DATABASE: allocating 51200 logical pages (100.0 megabytes) on disk 'data16'.
CREATE DATABASE: allocating 51200 logical pages (100.0 megabytes) on disk 'log01
Database 'scratch' is now online.

1> sp_dboption 'scratch',"scratch database", "true"
2> go
Database option 'scratch database' turned ON for database 'scratch'.
Running CHECKPOINT on database 'scratch' for option 'scratch database' to take e
(return status = 0)

1> use scratch
2> go
1> checkpoint
2> go
1> use master
2> go

1> sp_configure 'compression memory size'
2> go
Parameter Name Default Memory Used Config Value Run Value Unit
Type
------------------------------ -------------------- ----------- -------------------- -------------------- --------------------
----------
compression memory size 0 152 0 0 memory pages(2k)
dynamic
(1 row affected)
(return status = 0)
1> sp_configure 'compression memory size',64
2> go
Parameter Name Default Memory Used Config Value Run Value Unit
Type
------------------------------ -------------------- ----------- -------------------- -------------------- --------------------
----------
compression memory size 0 280 64 64 memory pages(2k)
dynamic
(1 row affected)


1> create archive database archivedb
2> on data15='50M'
3> with scratch_database = scratch
4> go
CREATE DATABASE: allocating 25600 logical pages (50.0 megabytes) on disk 'data15'.

1> load database archivedb from "/data/sybase/testing_host/dump/test_db.dmp1"
2> stripe on "/data/sybase/testing_host/dump/test_db.dmp2"
3> go

1> load database archivedb from "/data/sybase/testing_host/dump/test_db.dmp1"
2> stripe on "/data/sybase/testing_host/dump/test_db.dmp2"
3> go
Started estimating recovery log boundaries for database 'archivedb'.
Database 'archivedb', checkpoint=(303154, 21), first=(303154, 21), last=(303155, 6).
Completed estimating recovery log boundaries for database 'archivedb'.
Started ANALYSIS pass for database 'archivedb'.
Completed ANALYSIS pass for database 'archivedb'.
Started REDO pass for database 'archivedb'. The total number of log records to process is 11.
Redo pass of recovery has processed 2 committed and 0 aborted transactions.
Completed REDO pass for database 'archivedb'.
Use the ONLINE DATABASE command to bring this database online; ASE will not bring it online automatically.
1> online database archivedb
2> go
Started estimating recovery log boundaries for database 'archivedb'.
Database 'archivedb', checkpoint=(303154, 21), first=(303154, 21), last=(303155, 6).
Completed estimating recovery log boundaries for database 'archivedb'.
Started ANALYSIS pass for database 'archivedb'.
Completed ANALYSIS pass for database 'archivedb'.
Recovery of database 'archivedb' will undo incomplete nested top actions.
Database 'archivedb' is now online.
1> use archivedb
2> go
1> set rowcount 5
2> go
1> select name from sysobjects where type='U'
2> go
name
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
testing_FPOSDailyFunding
testing_IDeltaContracts
testing_RMSRates
testing_ESSPLFXRpt
testing_ESSAlgo
(5 rows affected)
1> set rowcount 0
2> go
1> select * from sysaltusages where 1=2
2> go
dbid location lstart size vstart vdevno segmap
------ ----------- ----------- ----------- ----------- ----------- -----------
(0 rows affected)
1> set rowcount 5
2> go
1> select * from sysaltusages
2> go
dbid location lstart size vstart vdevno segmap
------ ----------- ----------- ----------- ----------- ----------- -----------
8 4 0 256000 1 24 3
8 4 256000 51200 1 24 4
8 4 307200 256000 1 24 3
8 5 0 32 42 26 3
8 5 32 32 51 26 3
(5 rows affected)

ASE Interview Questions!

What is Identity Colum?
What is the advantage and disadvantage of Identity coloums?
From performnace point of view ,which is better  if exists or if not exists?
How can we avoid fragmentation in table?
There is update statement on  one APL and one DOL table. Which one would be fatser?Consider the cases:  where clause on index cluster index coloum , other case not using any index.
Why the reorg is faster on DOL table as compare cluster index rebuild on APL?
Wht cluster index with sorted_data on APL is faster than reorg rebuild in DOL?
What is Sybase recommendation for tempdb size, suppose we have 300GB , 150GB dbs are inserver, wht would be the sybase recommendation for sizing of tempdb?
Whats the difference between dsysnc and direct io?
Suppose we are not concerning about the recovery of the database, which would be better for performance dsync(on/off) or direct io and why?
Whats the asynchronus prefetch ? How is it helping in performance enhance?
We having a 4k page size server, what can be possible pool size in the server?
As Sybase recommends 4K size pool for log usage in 2k page size server , please let me know the pool recommendtaion for 4K pagesize server?
How can we reduce the spinlock without partioning the data cache?
Can we have the spinlock contention with single engine?
In sysmon report what are the five segment you will be looking for performance?
Whta is meta data cache?
Whta is the archive database?
How can we enable the acrhive database for compresssed backup?
Hows the object level recovery is possible in ASE?
How can we find the culprit spid which has filled up th etempdb database?
How can we find the culprit spid which is badly used the log segment of  tempdb?
Whats partioning? How partioning helping in increaeing the performance?
Suppose a table is partioned based on a coloum, how dataserver will be handle  the insert on the table?
Apart from the query plans, wht else resides in proc cache?
What is new config param "optimization goal"? Whats the parameter we need to provide it?
User is experiancing very slow performace, what can be the reason for this slowness?
What is engine affinity and how can set the engine affinity?
If there are 3 cpus in the box, how many engine we can configure ?
Suppose dataserver is running very slow and sp_monitor is showing 100% cpu usages, what can be possible issue? Where will you look at?
What is the error classes in replication server?
What is the diffrence between Warm standby and table level replication?
Can you please let me know five case when the thread goes down in replication?
What are triggers? What are type of triggers and how many triggers can we configure on a table?
What are diffrecnt locking scheme in ASE and what are the latches?
How can we dump a replication queue?

Friday, March 4, 2011

ASE Installation on Linux : Using Fedora Vmware Machine on Windows

1. Download the free vmware player from the vmware website: www.vmware.com/download/player/

2. Install the vmplayer which you have downloaded above.

3. Download the virtual appliance for Fedora 10 OS. http://www.vmware.com/appliances/directory/59370

4. Unzip your vitual appliance.

5. After unzip, you need to start Fedora.10.vmx file. It will start your guest OS.





For Sybase Installation:

6. Crete the sybase user and adduser in sybase group.

7. For installation of ASE on Linux requires 64MB shared memory. So modify the /etc/sysctl.conf  with kernal.shmmax euqls to more than 64 MB.

8. Run  sysctl -p /etc/sysctl.conf  to take place the kernel level setting.

9. Now login with sybase account, down load or copy the ASE software from Sybase website and start as below.

10. Please see the below slide show for further installation:

[slideshow]

Monday, February 21, 2011

Sybase Interview Ques Updated!!

Guys,

Updated the Sybase ASE/Rep Interview Question Page which I came across recently.

Please have a look @  http://sybaseblog.com/interviewquestions/

Happy Learning !!

sybanva

Sunday, February 6, 2011

Default,Rules and User Defined Datatype

Question
=======
Consider a table creation script
create table table1(id int not null,
cost smallmoney default $10
)
will it allow null value in column "cost"?

Answer
======
No


Source (Unleashed)
Question
=======
How to find all tables and columns which are bind with a rule/default?
Answer
======
select "table"=o.name, "column"=c.name,"user"=user_name(uid),"rule"=object_name(domain)
from sysobjects o,syscolumns c
where o.id=c.id
and object_name(c.domain)='rule/default name'

Sequence of events when using datatypes
=================================
sp_addtype ssn_type, 'char(9)', 'not null'
go

create rule ssn_rule as
@ssn between '001111' and '1111111'
or @ssn = 'N/A'
go

create default ssn_default as
'N/A'

sp_bindrule ssn_rule,ssn_type
sp_bindefault ssn_default,ssn_type

create table ssn_table
(ssn ssn_type, name varchar(30))
go
==================
A rule or default bound explicitly to a column override a rule or default bound to a datatype. A subsequent bind to the datatype replaces the bind to the column as long as the column and datatype have the same rule or default prior to modification.

Renaming Objects

(Source - Unleashed)
Question
=======
If name of table is changed then stored procedure and views would work or will change to invalid state?

Answer
======
Even though the name of table has changed, objects like views and procedures that refer to that table by name are not affected by the change in the name. That is because SQL-based objects like Views and Procedures are stored both as text in the syscomments table and pre-parsed query tree identifying related objects by ID instead of Name. When a table name changes, a dependent view still works because the objectID of the table (stored in sysobjects) does not change.

Tuesday, February 1, 2011

Performance Tuning – Scenario Based

Suppose we have a join order as below in our query
#tmp > Table1 > Table2>
but query plan would be making join order as below
Table1 > Table2 > #tmp
and it would be causing a whole index scan on both the tables Table1 and Table2 (which is as per the people expectation) before we use temp table to filter out results. However, still we can get performance improvement.
Solution --> We can use "set forceplan on" to force the join order. Though we will have table scan on Table1 and Table2 because of "forcing", we still could get the performance improvement by avoiding index scan on the large tables Table1 and Table2 because table scan on less number of records (due to filteration by #tmp table) can be faster than index scan on large number of records.

Thursday, January 13, 2011

Performance Tuning - Scenario Based

Scenario 1
------------
If an application makes multiple statement and each statement calls to a specific stored procedure. Thereby, being a multithreaded application it will call stored procedure multiple times at a time. It has been noticed that for some calls procedure takes longer time for different set of parameters. What could be the issue?

Solution 1
-----------
First we can’t blame sqarely on stored procedure for the slower performance. We have few options here
1. Reduce the number of concurrent calls to stored procedure.
2. Check whether the procedure is calling any child procedure with input parameter or not. Suppose child procedure is looking for location and if parent procedure is passing location as an input parameter and while the absence of this input parameter child procedure might be processing all available locations, which could be in huge number, and consuming time. So before calling the child procedure, apply proper check which would reduce the time consumptions for remaining calls.

Wednesday, September 22, 2010

Sybase ASE 12.5 to 15 Upgradation Steps -II

Upgrade Steps:

Before proceeding with any further steps , please make sure preupgrade step is clean  and you have backup of all databases, tables etc.

1. Make sure you are in ASe 15 enviorment, ( by executing .profile_15)

2. cd to sample resource files directory.

3. copy the sql server resource file with new name before modifying original file.

4. Edit the resource file for the old sybase home dir (ASE 12.5),for reserver word check yes and update the resource file as per your enviorment.

5. No need to shutdown your ASE 12.5 server, sqlupgradres will take care all the things.

6.  Only execute this command once you have done with all above steps and you have taken all backup. (MOST IMPORTANT)

sqlupgraderes again perform preupgrade, before actual upgrade.( you can modify its behaviour in resource file).

sqlupgraderes will copy automatically the interface file, cfg file , run server file in ase 15x.

Execute the following command with resource file: sqlupgraderes -r <resource_file_name>

Copying interfaces file entry to new directory...

The interfaces file entry has been copied to the new directory.

Running preupgrade program...

The preupgrade program has completed successfully.

Checking reserved words in each database...

No reserved word conflicts were found.

Checkpointing all databases...

All databases have been checkpointed.

Copying configuration file to new directory...

The configuration file has been copied to the new directory.

Updating RUN_SERVER file...

The RUN_SERVER file has been updated.

Doing pre-upgrade modifications...

Pre-upgrade modifications succeeded.

Restarting Adaptive Server....

Adaptive Server has been restarted.

Running upgrade program...

The upgrade program has completed successfully.

Restarting Adaptive Server....

Adaptive Server has been restarted.

Running installmaster script...

installmaster: 10% complete.

installmaster: 20% complete.

installmaster: 30% complete.

installmaster: 40% complete.

installmaster: 50% complete.

installmaster: 60% complete.

installmaster: 70% complete.

installmaster: 80% complete.

installmaster: 90% complete.

installmaster: 100% complete.

The installmaster script has been successfully installed.

Running installcommit script...

The installcommit script has been successfully installed.

Installing common character sets (Code Page 437, Code Page 850, ISO Latin-1,

Macintosh and HP Roman-8)...

Character sets installed.

Restarting Adaptive Server....

Adaptive Server has been restarted.

Done



6. Log in the server, check the current version with @@version, @@boottime, database/device status.



Post-upgrade tasks:



1. Installing 15x stored procedures after upgrade depending which function is being used on the server.

installsecurity – Run this script if the Adaptive Server Auditing functionality was enabled in your earlier installation.

installhasvss – Run this script if the HA functionality is enabled and the HA feature is currently in use in the upgraded installation of        Adaptive Server.

Installmodel

instmsgs.ebf

Check the installation script version using sp_version by logging in ASE.

2. Compare sp_configure output to see if there is any difference. Verify procedure cache allocation after upgrading. Verify data cache has no change.

3. Make sure license file is used.

save the license files with a .lic file name extension to the SYSAM-2_0/licenses directory of the license server installation.

Modify the variable in .profile for any instances on the same box.

For example:

LM_LICENSE_FILE=servername.lic

If you not having lic file, it will run under grace period of 1 months, you will get same warning in errorlog.

4. Reboot the instance

5. Reenabling auditing if needed.


Wednesday, September 1, 2010

Renaming the Adaptive Server - ASE

Before doing any step ;

i) Please take the backup of master database, including all other important critial databases.
ii) Please take the backup of all files which you are modifying to backout in case of any issue.
iii) Stop the client/app activity on the server.

1. First modify the sysservers table in master database and shutdown the dataserver.
Enable allow update on system table, modify sysservers for srvname and srvnetname with new server.

2. Copy the RUN Server file with new name.

3. Modify the new RUN server file for new server name, errorlog file name(optional), config file name (optional).

4. If you are modifying any cfg file name in new RUN server file, please copy the old cfg file with new name.

5. Take the backup of the interfaces file, after that modify the new servername are just add the new server name with different port number.

6. Now restart your dataserver with new RUN server file.

7. Verify the connection from isql/app team.

Same step we can repeat for the Sybase backup Server.

Thanks!!

Tuesday, August 17, 2010

Monday, March 29, 2010

Dataserver Health Check Script

Hi Folks,

This is going to be first post of month march, was busy due to relocation.  Now new topic health check...

In our production support environment we need do the health check on our data server on time to time basis, such as after the any long activity, in the production monitoring, after the server restart, and there are lot of many more cases.

I have tried to compile the Hc script v 1.0 as below , I am still trying to improve it , your suggestions and thoughts most welcome...

/***************************************************************
## Dataserver Health Check - Version 1.0
## Intial Drafted by - sybanva for SYBASETEAM.COM
## Date - 19th Feb 2010
****************************************************************/

print "#########################################################"
set nocount on
go
print "--------------------------------------------------------"
print " DataServer Checks"
print "--------------------------------------------------------"
go
select @@version "DATASERVER VERSION"
go
select @@servername "Instance Name", @@maxpagesize " Page Size of Instance"
go
select getdate() "Current Date", @@boottime "Instance Startup date"
go
print "--------------------------------------------------------"
print " Active Trace Flags"
print "--------------------------------------------------------"
dbcc traceon(3604)
go
dbcc traceflags
go
print "--------------------------------------------------------"
print " Process Status"
print "--------------------------------------------------------"
select spid SPID,cmd COMMAND,cpu "CPU Usage",physical_io "PHYSICAL IO",ipaddr "IP ADDRESS",loggedindatetime "LOGGED IN DATE",hostprocess "Host PROCESS ID" from sysprocesses where physical_io>0 or cpu >0
go
print "--------------------------------------------------------"
print " Long Running Process Status"
print "--------------------------------------------------------"
If exists (select count(1) from syslogshold where spid <> 0)
print "<<<<<<<< NO LONG RUNNING TRANS AT THIS MOMENT >>>>>>>>>"
else
select dbid "Database ID",spid SPID,starttime "START TIME",name NAME from syslogshold where spid <> 0
go
print "--------------------------------------------------------"
print " Blocking Process Status"
print "--------------------------------------------------------"
go
If not exists (select count(1) from sysprocesses where blocked > 0)
select spid SPID,cmd COMMAND,cpu "CPU Usage",physical_io "PHYSICAL IO",ipaddr "IP ADDRESS",loggedindatetime "LOGGED IN DATE",hostprocess "Host PROCESS ID" from sysprocesses where blocked > 0
else
print "<<<<<<<< NO BLOCKING PROCCESS AT THIS MOMENT >>>>>>>>>"
go
print "--------------------------------------------------------"
print " Checks for Zombie SPIDs"
print "--------------------------------------------------------"
go
if exists(select spid from master..syslogshold slh where slh.spid <> 0 and slh.spid not in(select spid from master..sysprocesses))
select spid from master..syslogshold slh where slh.spid <> 0 and slh.spid not in(select spid from master..sysprocesses)
else
print "<<<<<<<< NO ZOMBIE SPIDS AT THIS MOMENT >>>>>>>>>"
go
print "--------------------------------------------------------"
print " Check for Engines"
print "--------------------------------------------------------"
go
sp_configure 'number of engines'
go
select engine "Engine No",osprocid "OC Proc ID",status "STATUS",starttime "START TIME" from sysengines
go
print "--------------------------------------------------------"
print " Checks for Database Status"
print "--------------------------------------------------------"
go
select name "DB NAME",dbid "DBID",status "STATUS",crdate "CRATION DATE",dumptrdate "LAST DUMP TRAN DATE" from sysdatabases
go
print "--------------------------------------------------------"
print " Checks for Suspect/OFFLINE Database Status"
print "--------------------------------------------------------"
go
if exists(select name from sysdatabases where status in (-32768,64,256,32))
select name, status from sysdatabases where status in (-32768,64,256,32)
else
print "<<<<<<<< ALL DBS STATUS IS NORMAL >>>>>>>>>"
go
print "--------------------------------------------------------"
print " Checks for Servers"
print "--------------------------------------------------------"
select srvname "SERVER NAME",srvnetname "SERVER N/W NAME" from sysservers
go
print "--------------------------------------------------------"
print " Checks for Backup Server"
print "--------------------------------------------------------"
go
SYB_BACKUP...sp_who
go
print "--------------------------------------------------------"
print " Checks for Monitor config"
print "--------------------------------------------------------"
go
sp_monitorconfig "max memory"
go
sp_monitorconfig "number of locks"
go
sp_monitorconfig "number of open indexes"
go
sp_monitorconfig "number of open objects"
go
sp_monitorconfig "number of user connection"
go
sp_monitorconfig "procedure cache size"
go
Same Thread @ http://www.sybaseteam.com/dataserver-health-checkout-qa-script-t-684-3.html

Saturday, January 23, 2010

How to check the Replication Latency manually?

Hi Folks,
For the checking latency between Primary and Replicated DBs , we have several methods.

Here, I am posting the manual method for checking the replication latency. If you have any more thoughts, please comment it out.

Rite Now I am travelling to Delhi, my train got late, so I am spending my time with my fav, with new posting in blog.

For calculating the latency, we can make two tables in PDB and RDB with column as defaut datetime, and setup replication between these two tables.

Before excuting the batch of your's queries, insert the id (only for reference for the point, where we executed the insert statement) and it will update the primary_datetime by default current system date.

After the completing the batch, insert the the next id, automaticaly it will get the finish date in default column.

Now go to RDS and check the diff between primary_datetime and replicate_datetime.

1. IN PDS/PDB Create one table as
create table timer_table(id int, primary_datetime datetime default getdate())

2. In RDS/RDB create same table with one extra coloum
create table timer_table(id int,primary_datetime datetime,replicate_datetime default getdate())

3. Setup the replication between both.

4. Before executing the batch insert the value in table as
insert into timer_table (id) values(100)

5. Execute your batch for queries.

6. After completion, execute the insert statement as
insert into timer_table (id) values(101)

7. Now go in the replicated dataserver(RDS/RDB) and check the diff between primary_datetime and replicate_datetime.
select datediff(ss,min(primary_datetime),max(replicate_datetime)) from timer_table

With the help of id you can check the latency upto that point. Even,You can customize this method for checking the latency.

Thanks,
Source : www & sybooks.
Same Thread @ : http://www.sybaseteam.com/how-to-test-latency-t-692.html

Saturday, January 16, 2010

Basic Working of Sybase Replication Server

Hey Guys,

Its my first post of New Year 2010. I am trying to put the basic understanding of Replication Server and whys it needs more monitoring. Hoping you will enjoy it!

Wishing you great new year 2010 ahead !

Basic Working of Replication Server

PDS : Primary Data Server
PDB : Primary Data Base

RDS : Replicated Data Server
RDB : Replicated Data Base

PRS : Primary Replication Server
RRS : Replicated Replication Server

RSSD : Replication System Database

1. RepAgent reads the record from transation log of the PDB for the tables which are marked for replication.

2. Logs into the PRS and write transactions in inbound queue of PDB in stable device.

3. Holds Data in inbound queue , untill it recieves commit.

4. Uses subscription information in its RSSD to decide what to do with the each transaction, after the commit:

i Discards the rans if there is no subscription.
ii Writes the transaction to the out bound queue if there are subscription.

5. Writes commited trans only in outbound queue according to subscription.

6. Sends transactions to their destination, it depends upone two things

i) if Replicated Database is managed by PRS
Apply changes to RDB using the DSI thread our the connection.

ii) If their are two server, RRS is managing RDB
Send commited trans to RRS over route.
RRS apply that changes in RDB

7. If apropriate, uses function string information in RSSD to compose command to submit to replicate database.

Source : sybooks and www.

As you people are seeing, there are lot of movement of trans/record , and for these trans movements Replication Server uses lot of threads(DSI,RSI,SQT,SQM etc).

If any one of thread stops , replication ceases , even it can hamper PDB performance.

Thats why it is little bit difficult to manage, not difficult, we can say, its need better monitoring.

If I am missing any thing , please add in comments.

Thanks.
AnVa
Same Thread at : http://www.sybaseteam.com/basic-working-of-replication-server-t-675.html

Thursday, December 17, 2009

ASE15 New Features - I: DBA Perspective

*Source : Sybase Resources on world wide web. Sybooks.

  • MDA Installation Automaticaly.

  • ASE 15.x isql client can now do large network packets.

  • IPv6 platform support : IPv6 is now supported on IBM AIX. 15.0.2 ESD#1.

  • Encrypted columns : meets US Government encryption standards.

  • IN ASE 15.x, there are a number of partition level operations you can do. Reorgs can be done on a partition level.

  • ASE 15.0 and later versions no longer use vdevno. i.e. the disk init syntax doesn’t need to mention the vdevno parameter(Even earlier, it was optional).

  • Before 15.0, after changing a database option we need to use that database and do checkpoint on it. But ASE15.0 doesn’t need this.

  • ASE 15 Cluster Edition, a high-availability version of ASE similar to Oracle's RAC.














  • Dumping and loading databases with password protection:You can protect your database dump from unauthorized loads using the password parameter of the dump database command. If you include the password parameter when you make a database dump, you must also include this password when you load the database.











  • Fast bcp:  In 15.0.2, fast BCP is also allowed for indexed tables. Rest all things about bcp remain same, like select into/bulkcopy/pllsort' is enabled; logging only the page allocations in log etc.














  • Disk init syntax:Disk init syntax in 12.5 expects size parameter in K, M, and G only. From 15.0 and onwards, T (Terabyte) can be specified.Also, pre 15.0; the maximum size of a device was 32GB














  • In ASE 15.0.2 IR, you can run sp_configure nondefault, which will list out, the configuration parameters set to non-default values. It is veru usefull to check which config not using the dafult values.














  • Automatic update statistics : Instead of manually running update statistics at a certain time, you can set update statistics to run automatically at the time that best suits your site and avoid running it at times that hamper your system. The best time for you to run update statistics is based on the feedback from the datachange function. datachange also helps to ensure that you do not unnecessarily run update statistics.In ASE 15.0, Update statistics is not necessary after index rebuild. Also sp_recompile is not necessary after index rebuild.














  • Application tracing:Version 15.0.2 of ASE comes with the new feature of 'application tracing'. Understanding this feature is a must for every DBA, because it provides a simple mechanism to figure out what your client applications are actually doing: apptracing lets you capture the SQL submitted to the ASE server by a specific client connection, and writes it into a file.     set tracefile '/tmp/spid54.trace.out' for 54 # where 54 is spid            set show_sqltext on














  • VLDB Support: ASE 15 allows you to assign two billion logical devices to a single server, with each device up to 4 Tb in size. ASE 15 supports over 32,767 databases, and the maximum size limit for an individual database is 32 terabytes, extending the maximum storage per ASE server to over 1 million terabytes!














  • Functional indexes: When applications need to search tables based on the result of a function, performance can suffer. Functional indexes allow the server to build indexes on a table based on the result of a function. When repeated searches use that function, the results do not need to be computed from scratch.














  • Row-locked system catalogs :Adaptive Server version 15.0 converts most system catalogs to a datarows locking scheme. These system catalogs continue to use allpages locking scheme: Materialized tables such as syslocks and sysprocesses. These tables are generated during run-time and their locking schemes are irrelavent for concurrency.


sysmessages and sysusermessages, which are read-only tables.

Auditing tables in sybsecurity, which are write-once and read many times.









  • Semantic partitions/smart partitioning:  ASE 15 makes large databases easy to manage. And more efficient by allowing you to divide tables into smaller partitions which can be individually managed. You can run maintenance tasks on selected partitions to avoid slowing overall performance, and queries run faster because ASE 15’s smart query optimizer bypasses partitions that don’t contain relevant data.














  • Query Processor: The Adaptive Server version 15.0 query processor is self-tuning, requiring fewer interventions than earlier versions. This version of Adaptive Server has less reliance on worktables for materialization between steps since the engine supports data flow between steps. However, more worktables could be used in cases where Adaptive Server determines that hash and merge operations are effective.














  • Scrollable cursors:With large data sets, filing through a mountain of results data can be difficult. ASE 15’s bi-directional scrollable cursors make it convenient to work with large result sets because your application can easily move backward and forward through a result set, one row at a time. This especially helps with Web applications that need to process large result sets but present the user with subsets of those results.














  • Computed columns: Often applications repeat the same calculation over and over for the same report or query. ASE 15 supports both virtual and materialized columns based on server calculations. Columns can be the computed result of other data in the table, saving that result for future repeated queries.














  • Query processing metrics (qp metrics):Query processing (QP) metrics identify and compare empirical metric values in query execution. When a query is executed, it is associated with a set of defined metrics that are the basis for comparison in QP metrics.














  • Large identifiers:There are new limits for the length of object names or identifiers: 255 bytes for regular identifiers, and 253 bytes for delimited identifiers. The new limit applies to most user-defined identifiers including table name, column name, index name and so on. Due to the expanded limits, some system tables (catalogs) and built-in functions have been expanded.














  • User-defined web services:In addition to the Web methods provided by the Adaptive Server Web Services Engine, Web Services enables you to create Web services and execute SQL commands in Adaptive Server Enterprise using either a Web browser or a SOAP client. These user-defined Web services use existing security and auditing control inherent in Adaptive Server Enterprise.


Will post New Features part 2, once get completed.
If you find any new feature, which is very useful, please comment out in this section.

-AnVa

Saturday, December 12, 2009

Syssrvroles dropped

Hey Guys!
In one case, I dropped out the syssrvroles accidently. Now, no one having any roles, even sa is not having its roles..I hav backup of all system tables and dump of master db. But We dont hav sso_role for any login we can't do the bcp in , we can't insert any row in any system table. Even we can't change the allow update on system table, requires sso_role. Anyway. We have backup of master..so we can recover it..by loading the dump of master , but still need suggestions....