Sybase Commands

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

2>

Displays the space usage information for the transaction log of the current
database (pubs2):

sp_spaceusage 'display', 'tranlog'


TableName TotalPages UsedPages CLRPagesFreePages PctUsedPages PctFreePages
--------- ----------- --------- ----------------- ------------- -----------
syslogs 4096.0 18.0 0.0 1482.0 0.43 36.18

Eg:-
3> sp_spaceusage 'display', 'tranlog'
4> go
All the page counts in the result set are in the unit 'KB'.
TableName TotalPages UsedPages CLRPages FreePages PctUsedPages PctFreePages
--------- ---------- --------- -------- --------- ------------ ------------
syslogs 3145728.0 2037408.0 0.0 1108320.0 64.76 35.23

(1 row affected)
(return status = 0)

--------------------------------------------------
Prints a summary of space used in the current database:

sp_spaceused
database_name database_size
--------------- ---------------------------
master 5 MB
reserved data index_size unused
--------- --------- ----------- --------
2176 KB 1374 KB 72 KB 730 KB
Example 5
Reports on the amount of space reserved and the amount of space available for the
transaction log:

sp_spaceused syslogs
name rowtotal reserved data index_size unused
---------- --------- --------- ------- ---------- ----------
syslogs Not avail. 32 KB 32 KB 0 KB 0 KB
Usage

Eg:-

1> sp_spaceused syslogs


2> go
name total_pages free_pages used_pages
reserved_pages
--------------- --------------- --------------- ---------------
---------------
syslogs 196608 69270 127338
0

(1 row affected)
(return status = 0)
1>

----------------------------------------------------------------------
Command to check the log space
To check the space used by a database�s transaction log, first use the database,
then enter:

(return status = 0)
1> use ADQ
2> go
1> dbcc checktable(syslogs)
2> go
Checking table 'syslogs' (object ID 8): Logical page size is 16384 bytes.

Checking partition 'syslogs_8' (partition ID 8) of table 'syslogs'. The logical


page size of this table is 16384 bytes.
The total number of data pages in partition 'syslogs_8' (partition ID 8) is
685863.
Partition 'syslogs_8' (partition ID 8) has 131230931 data rows.

The total number of data pages in this table is 685863.


*** NOTICE: Space used on the log segment is 688768 pages (10762.00 MB),
92.62%.
*** NOTICE: Space reserved on the log segment is 0 pages (0.00 MB), 0.00%.
*** NOTICE: Space free on the log segment is 54912 pages (858.00 MB), 7.38%.
Table has 131230931 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
1>

we have 7.38% free space

after account lead confirmation, I have taken the log backup, after checking any
active jobs on the system, there was no active jobs, so I initiated the log backup
3> dump transaction ADQ to "K:\transactionlogbkp01132020.trn"
4> go
Backup Server session id is: 13. 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
K:\transactionlogbkp01132020.trn.
Backup Server: 6.28.1.1: Dumpfile name 'ADQ200130A251 ' section number 1
mounted on disk file 'K:\transactionlogbkp01132020.trn'
Backup Server: 4.166.1.1: Using dbiosize of 262144 bytes for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.165.1.1: Using iocount of 1 for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.166.1.2: Using zonesize of 262144 bytes for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.166.1.3: Using blocksize of 65536 bytes for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.165.1.2: Using numzones of 3 for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.165.1.3: Using archcnt of 1 for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.165.1.4: Using dbdevcnt of 1 for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.166.1.4: Using pagesize of 16384 bytes for device
K:\transactionlogbkp01132020.trn.
Backup Server: 4.58.1.1: Database ADQ: 511092 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 1025174 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 1539256 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 2053338 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 2567420 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 3081502 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 3595584 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 4109666 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 4623748 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 5137830 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 5650760 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 6164842 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 6678924 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 7193006 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 7707088 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 8221170 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 8735252 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 9249334 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 9763416 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 10277498 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 10791580 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database ADQ: 10974414 kilobytes DUMPED.
Backup Server: 3.43.1.1: Dump phase number 3 completed.
Backup Server: 4.58.1.1: Database ADQ: 10974436 kilobytes DUMPED.
Backup Server: 3.42.1.1: DUMP is complete (database ADQ).
1>
2> dbcc checktable(syslogs)
3> go
Checking table 'syslogs' (object ID 8): Logical page size is 16384 bytes.

Checking partition 'syslogs_8' (partition ID 8) of table 'syslogs'. The logical


page size of this table is 16384 bytes.
The total number of data pages in partition 'syslogs_8' (partition ID 8) is 12.
Partition 'syslogs_8' (partition ID 8) has 2911 data rows.

The total number of data pages in this table is 12.


*** NOTICE: Space used on the log segment is 2917 pages (45.58 MB), 0.39%.
*** NOTICE: Space reserved on the log segment is 0 pages (0.00 MB), 0.00%.
*** NOTICE: Space free on the log segment is 740763 pages (11574.42 MB),
99.61%.
Table has 2911 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.

After taking backup now, we have 99.61% free space.

=======================================----------------------------------------
===========================================
Also ensure all the sybase recommendations are set.

1539124 SYB: Database Configuration for SAP on Sybase ASE

1585981 SYB: Ensuring Recoverability for SAP Sybase ASE

1588316 SYB: Configure automatic database and log backups

1801984 SYB: Automated management of long running transactions

Specific to this log of yours.


1836607 SYB: How to solve error 1105 in database "saptools"

1989768 SYB: Error 1105 encountered against the log segment of the saptools
database

1931223 SYB: SQL Error 1105 - ASE database data and/ or log segment is full

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++
use master

sp_helpdevice <data_file_device/log_file_device>

Below procedure explains the procedure to extend the space on the data/log volume.

Login to dbsql using SA or SAPSA user:

In Sybase data and log files are organize in the form of Devices. Search for the
device you should be extending first before allocating the space the data or log
file using below command:

use master

sp_helpdb <DBID>

go

Ex: sp_helpdb ERP

In the Result Set 2, you can find the related devices.

find_device

Next find the device location using the below command:

use master

sp_helpdevice <data_file_device/log_file_device>

go

device_name

Now resize the device using the below command:

use master

disk resize

name = �<device_name>�,

size = �<size>�

go

Now assign the extended device to the database:

For data files:


user master

alter database <DBSID> on <device_name> = <Size>

go

For log file:

use master

alter database <DBSID> log on <device_name> = <Size>

go

-----------------------------------------------------------------------------------
-------

saptools log backup

1> dump transaction saptools to "K:\saptoolslogbkp01212020.trn"


2> go
Backup Server session id is: 66. 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 K:\saptoolslogbkp01212020.trn.
Backup Server: 6.28.1.1: Dumpfile name 'aptools2002100686' section number 1
mounted on disk file 'K:\saptoolslogbkp01212020.trn'
Backup Server: 4.58.1.1: Database saptools: 205812 kilobytes DUMPED.
Backup Server: 3.43.1.1: Dump phase number 3 completed.
Backup Server: 4.58.1.1: Database saptools: 205834 kilobytes DUMPED.
Backup Server: 3.42.1.1: DUMP is complete (database saptools).
1>

2> use saptools


3> go
1> dbcc checktable(syslogs)
2> go
Checking table 'syslogs' (object ID 8): Logical page size is 16384 bytes.

Checking partition 'syslogs_8' (partition ID 8) of table 'syslogs'. The logical


page size of this table is 16384 bytes.
The total number of data pages in partition 'syslogs_8' (partition ID 8) is 1.
Partition 'syslogs_8' (partition ID 8) has 128 data rows.

The total number of data pages in this table is 1.


*** NOTICE: Space used on the log segment is 52 pages (0.81 MB), 0.40%.
*** NOTICE: Space reserved on the log segment is 0 pages (0.00 MB), 0.00%.
*** NOTICE: Space free on the log segment is 13004 pages (203.19 MB), 99.60%.
Table has 128 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.

You might also like