Wednesday, December 28, 2011

List Server Reserved Words

Run this simple query in isql to find all the reserved words for Adaptive Server Enterprise .
 To list all reserved words for Adaptive Server Enterprise, log in to isql and run this query:

     select name from spt_values where type = "W"


The spt_values table is a look-up table in the master database that stores system values used by other server processes.


Run this simple query in isql to find all the reserved words for Adaptive Server Enterprise .
 To list all reserved words for Adaptive Server Enterprise, log in to isql and run this query:

     select name from spt_values where type = "W"


The spt_values table is a look-up table in the master database that stores system values used by other server processes.


Monday, December 26, 2011

Installing sybase on ubuntu

Just  installed ASE15.0.3 ESD#1  on ubuntu 7.04 inside virtual box.

Download the ASE Developer’s Edition.

1)Install the following package(Need to put  ubuntu 7.04 CD /DVD in Drive).

apt-get install libaio1 



2)Sybase requires at lea Ist 300 MB shared memory,so increase.

/sbin/sysctl -w kernerl.shmmax=300000000


3)Unzip sybase installation file

tar -xvf ase_1503_linuxx86.tgz


4)Now run the setup

chmod +x ./setup



Choose Express Edition install while installing.

5)Append  the contents of the SYBASE.sh to /etc/bash.bashrc.

6)We need to add sybase shared libraries to the library path.

gedit /etc/ld.so.conf.d/sybase.conf


7)Add these lines to the above file

/opt/sybase/OCS-15_0/lib3p
/opt/sybase/ASE-15_0/lib


8)Afterwards, update the paths

/sbin/ldconfig


9)In /opt/sybase/locales/locales.dat

Find the section:
[linux]

 Add the line:
locale = en_IN, us_english, iso_1
Just  installed ASE15.0.3 ESD#1  on ubuntu 7.04 inside virtual box.

Download the ASE Developer’s Edition.

1)Install the following package(Need to put  ubuntu 7.04 CD /DVD in Drive).

apt-get install libaio1 



2)Sybase requires at lea Ist 300 MB shared memory,so increase.

/sbin/sysctl -w kernerl.shmmax=300000000


3)Unzip sybase installation file

tar -xvf ase_1503_linuxx86.tgz


4)Now run the setup

chmod +x ./setup



Choose Express Edition install while installing.

5)Append  the contents of the SYBASE.sh to /etc/bash.bashrc.

6)We need to add sybase shared libraries to the library path.

gedit /etc/ld.so.conf.d/sybase.conf


7)Add these lines to the above file

/opt/sybase/OCS-15_0/lib3p
/opt/sybase/ASE-15_0/lib


8)Afterwards, update the paths

/sbin/ldconfig


9)In /opt/sybase/locales/locales.dat

Find the section:
[linux]

 Add the line:
locale = en_IN, us_english, iso_1

Temp db full

Since ASE 12.5 we can create a user defined tempdb (using sp_tempdb) and bind an admin login
 to this new tempdb. This admin account can then run sp_who to find out who filled tempdb and kill the process.

Sometimes the kill won't work The new 'multiple tempdb' feature in 12.5.0.3 allows you to avoid the problem that tempdb is full and  cannot access the fake tables in master.
In pre-12.5.0.3, we can get some information from different sources, like dbcc pss, dbcc lock and dbcc log

Follow these steps to solve tempdb full

 (i) use 'tempdb_space' resource limits (in 12.5+) and

 (ii) if your tempdb gets full anyway,use lct_admin to abort the transactions causing this.
 Instead of this  it's a good idea to

 (iii) enable the 'abort tran on log full' option for tempdb so that LOG SUSPEND statuses will not remain until the DBA takes action.


Since ASE 12.5 we can create a user defined tempdb (using sp_tempdb) and bind an admin login
 to this new tempdb. This admin account can then run sp_who to find out who filled tempdb and kill the process.

Sometimes the kill won't work The new 'multiple tempdb' feature in 12.5.0.3 allows you to avoid the problem that tempdb is full and  cannot access the fake tables in master.
In pre-12.5.0.3, we can get some information from different sources, like dbcc pss, dbcc lock and dbcc log

Follow these steps to solve tempdb full

 (i) use 'tempdb_space' resource limits (in 12.5+) and

 (ii) if your tempdb gets full anyway,use lct_admin to abort the transactions causing this.
 Instead of this  it's a good idea to

 (iii) enable the 'abort tran on log full' option for tempdb so that LOG SUSPEND statuses will not remain until the DBA takes action.


Sunday, December 25, 2011

orphan tables in tempdb

If an spid that owns the table no longer exists in sysprocesses.
This happens sometimes when a killed spid isn't cleaned up properly,
leaving temp tables behind.  These are called "orphaned" temp tables.

Running

    dbcc orphantables


will list orphaned tables in tempdb .

    dbcc orphantables ("drop")


will try to clean them up.
If an spid that owns the table no longer exists in sysprocesses.
This happens sometimes when a killed spid isn't cleaned up properly,
leaving temp tables behind.  These are called "orphaned" temp tables.

Running

    dbcc orphantables


will list orphaned tables in tempdb .

    dbcc orphantables ("drop")


will try to clean them up.

Friday, December 23, 2011

Top 10 large tables in database

Top 10 largest tables in a database by rowcount:
select

top 10

    name,

    row_count(db_id(), id)

from

    sysobjects

order by

    row_count(db_id(),id) desc

Top 10 largest tables in a database by allocated space:

select

top 10

    name,

    reserved_pages(db_id(),id)

/(1024.0 / (@@maxpagesize/1024.0) ) as "Allocated MB"

from

    sysobjects

order by

    reserved_pages(db_id(),id) desc

go

Top 10 largest tables in a database by used allocated space:

select

top 10

    name,

    used_pages(db_id(),id)

/(1024.0 / (@@maxpagesize/1024.0) ) as "Used MB"

from

    sysobjects

order by

    used_pages(db_id(),id)(db_id(),id) desc

go 
**These are not my own queries..Credit goes to Bret Halford on sybase forums.
Top 10 largest tables in a database by rowcount:
select

top 10

    name,

    row_count(db_id(), id)

from

    sysobjects

order by

    row_count(db_id(),id) desc

Top 10 largest tables in a database by allocated space:

select

top 10

    name,

    reserved_pages(db_id(),id)

/(1024.0 / (@@maxpagesize/1024.0) ) as "Allocated MB"

from

    sysobjects

order by

    reserved_pages(db_id(),id) desc

go

Top 10 largest tables in a database by used allocated space:

select

top 10

    name,

    used_pages(db_id(),id)

/(1024.0 / (@@maxpagesize/1024.0) ) as "Used MB"

from

    sysobjects

order by

    used_pages(db_id(),id)(db_id(),id) desc

go 
**These are not my own queries..Credit goes to Bret Halford on sybase forums.

Thursday, December 22, 2011

sa Login locked?

Add "-T4044" to the command line in the RUN_server file.
This will  allow you to log in as 'sa'.



Add "-T4044" to the command line in the RUN_server file.
This will  allow you to log in as 'sa'.



Tuesday, December 20, 2011

Hi to All

Hi, All will get timely updates on this blog!!!
Hi, All will get timely updates on this blog!!!