Basic Important commands in Sybase

 How to list available instances in server

login to the os level and enter showserver command

NOTE : We can install multiple instances on server.

How to login Sybase instance

$ isql -S server_name -U user_name -X -w400

Password:

How to change your password

1> sp_password old_password,new_password

2> GO

How to check long running transactions

1>select *from syslogshold

2>go

How to list available databases

1> sp_helpdb

2> go

1> SELECT name FROM master..sysdatabases

2> GO

How to check all connections

1> sp_who

2> go

How to select a database

1> USE <DB NAME>

2> GO

How to list user tables in the database

1> SELECT name FROM sysobjects WHERE type='U'

2> GO

How to list views in the database

1> SELECT name FROM sysobjects WHERE type='V'

2> GO

How to list stored procedures in the database

1> SELECT name FROM sysobjects WHERE type='P'

2> GO

How to list all tables/views/procedures in the database

1> sp_help

2> GO

How to list the column names of a table with data type 

1> sp_help table_name

2> GO

How to display a stored procedure

1> sp_helptext <stored_procedure_name>

2> GO

How to get out of the database

1> QUIT

or

1> EXIT


Difference between full, cumulative and transaction log backups

Backup types :

1.Full database backup

2.Cumulative backup

3.Log/transactional backup 


The difference between the three are:


A full database dump, or simply database dump, will make a backup copy of the entire database

A cumulative database dump will make a copy of all pages that changed in the database since the last full database dump

A transaction log dump creates a copy of the transaction log and truncates the log

In terms of restoring the database the order that should be followed is


Restore from the last full back up

(optional) Restore from the latest cumulative dump since the last full backup

Apply all transaction logs since the last full backup (if step 2 is skipped) or cumulative backup (if step 2 is performed)

Compression levels in Sybase

The dump command includes two options that allow you to compress databases and transaction logs using Backup Server, thereby reducing your space requirements.

Compression levels are 0-9 and 100,101

Below image refers the backup file size depends on the compression level.





level 9 provides the highest compression ratio but also the heaviest CPU usage.

100 – the SAP ASE server uses FastLZ compression. The compression ratio that uses the least CPU usage; generally used for shorter data.

101 – the SAP ASE server uses FastLZ compression. A value of 101 uses slightly more CPU than a value of 100, but uses a better compression ratio than a value of 100.

 

Let’s use with compression in a single dump file command:

dump database PID to “/sybase/dumps/PID.dmp” with compression = 9

PID = database name

Syntax for striped backup with compression:

            dump database <DB NAME> to
                    "/path/<DB NAME>_comp_1.dmp" stripe on
                    "/path/<DB NAME>_comp_2.dmp" stripe on
                    "/path/<DB NAME>_comp_3.dmp" stripe on
                    "/path/<DB NAME>_comp_4.dmp" with compression = 9

Path: local file system path, where you want to store your backup files.

Example : /sybase/dumps/





Sybase interview questions


Ø What is sybase?

Ø Explain ASE architecture?

Ø What are the system roles ?

Ø What are the default databases ?

Ø Threads inside Sybase?

Ø what is time slice error and how to resolve timeslice -201 ?

Ø what is fill factor?

Ø Types of locks in Sybase?

Ø Row locking mechanism in ASE?

Ø what is the use of data cache,procedure cache,statement cache?

Ø Truncate only and no log difference?

Ø Dirty buffers?

Ø Reorg types ?

Ø Types of update statistics and how to check the last stats of the table?

Ø How to clear tempdb space ?

Ø How to separate tempdb from master ?

Ø How to check long running queries?

Ø What is the use of sybsystemdb?

Ø Clustered index and non clustered index ?

Ø Table partitions and its use ?

Ø What is the threshold actions ?

Ø what is the use of sysmon report?

Ø what is optdiag report ?

Ø How to run upgrade?

Ø What is zombie/ghost process?

Ø What is RAID in sybase ?

Ø Different types of replication and how to configure and maintain high availability?


Refer the below links for more :

https://testmydailyworks.wordpress.com/2012/11/28/sybase-all-in-one/

https://dbasdiary.com/home/important-15-sybase-ase-dba-interview-questions-and-answers/

https://www.bestinterviewquestion.com/sybase-interview-questions

https://www.wisdomjobs.com/e-university/sybase-interview-questions.html

http://dba.fyicenter.com/Interview-Questions/SYBASE/

https://www.globalguideline.com/interview_questions/Questions.php?sc=sybase_database

https://www.careerride.com/sybase-interview-questions.aspx

 



Sybase ASE Architecture

 


Sybase ASE consists of 

1.Processes (Dataserver/Backupserver)

2.Executable files

3.Internal threads

4.System databases

5.Shared memory

1.There 2 process for ASE one is Backupserver and another one is data server. ASE backup server which will help in supporting the dump and load of database and transaction log. Dataserver will help to maintain all other ASE operations.


2.ASE executable files are RUN server file, contains certain parameters that are required to startup the dataserver(ASE) also it contains the path/ location of error log file(which logs all console/error messages), location of configuration file(helps us in giving the information of the configuration parameters that are currently being set for the functionality of ASE), location of interface file(gives us information related to the connectivity), logical page size of the server. 


3.ASE internal threads 'port manager, network handler, ASTC handlers, HK chores, HK wash, HK GC, checkpoint worker, checkpoint sleep, mirror handler, deadlock tune, license heartbeat'.


4.When ASE is installed by default master, model, sybsystem, tempdb and sybsystemprocs will be created, we can create user databases and some additional databases called sybmgmtdb, sybsecurity, dbcc db. 

5.Coming to shared memory, it is divided into three parts
 

Procedure cacheSAP ASE maintains an MRU/LRU (most recently used/least recently used) chain of stored procedure query plans.

As users execute stored procedures, SAP ASE looks in the procedure cache for a query plan to use. If a query plan is available, it is placed on the MRU end of the chain, and execution begins.

If no plan is in memory, or if all copies are in use, the query tree for the procedure is read from the sysprocedures table

this will contain another component called 'statement cache' which holds the recently executed SQL query/ abstract plan.

The statement cache is a server-wide resource, which allocates and consumes memory from the procedure cache memory pool.

https://help.sap.com/docs/SAP_ASE/91d32d977a174c68829880bc020fc352/a99c032fbc2b10148ea4c5dc158b54e7.html

Data cache: This contains the recently executed data. By holding the data in this cache i/o will be reduced thereby increasing the performance. If the data is being fetched from the disk, it is known as 'physical i/o' and if the data is being fetched from the cache it is known as 'logical i/o'.


Log cache: This will hold the logs that are being generated with respect to any DML statements happened on the data.


How to reset/change login password in sybase

To reset/change the login password follow the below steps:

This is process is generic to change login password for named logins as well as sa login.

For sa login password change we need sapsso login ,for named logins we can use sa account .

Logon to isql session with sapsso login to change sa password :

isql -S<SID> -Usapsso -P<sapsso_password> -X -w9999

SID : sybase instance name which you can find by entering the showserver command in os level.


Syntax :

sp_password caller_passwd, new_passwd , loginame, immediate

go

caller_passwd : current login user password

new_passwd : new password which you want to give

Login name : specify the login name which you wanted change the password



use master

go

alter login sa with password “<sapsso_password>” modify password “<new_sa_password>”

go

OR 

sp_password caller_passwd, new_passwd,sa

go


NOTE : if you are not specifying the login name ,password will set for the current active login.


Refer the sybase info center for more info

https://infocenter-archive.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1502/html/sprocs/X96621.htm


Related topic:

https://infosybase.blogspot.com/2020/07/how-to-recover-sasapsso-password-in.html

How to lock/unlock sybase login

Steps to follow the lock/unlock sybase login

sp_locklogin used to lock/unlock an  Adaptive Server account or displays a list of all locked accounts

login isql with system administrator

>sp_locklogin <username>,"lock"

>go



sp_locklogin stored procedure is used to check the locked accounts

>sp_locklogin

>go



to unlock the login use the below command

>sp_locklogin <login_name>,"unlock"

>go



How to add user to database in sybase

User :

User is used to access the database and its objects

Adding Users

Adaptive Server requires a two-step process to add a user: sp_addlogin followed by sp_adduser.

to check the database user list need to enter the below command 

use <DB_NAME>

go

sp_helpuser

go

sp_adduser stored procedure is used to add the users in the database .

Here iam going to add SAPSR3 user in CL1 database .

Sybase history

Sybase  is a computer software company that develops and sells database management system (DBMS) and middleware products. The company was fo...