Determine Which Hard Drive the Database-Files/Transaction-Files are Stored

sybaseunix

I have posted the following question in another forum. I was told that this problem is related to Sybase (something to do with our likely use of raw partitions). That's why I re-post this question here. Sorry for multiple-posts.

I have an old Sybase server whose database is acting up. I have tried rebuilding the file-system and the database file. But the problem returns. I want to replace the hard drive that the database-files and transaction-files are stored. I want to determine exactly which hard drive it is because I am not familiar with Unix. Moreover, I also want to see if those files are stored in the same hard drive as the operating system or not; if they are, I will need to re-install the operating system as well as restoring the database to the new hard drive. Obviously this will be better if the database-files and the transaction-files are not in the same hard drive as the operating system. Please help me to determine those two things.

So far, I have found these:

(1) I use sp_helpdb command and find that the database files and the transaction files are stored in these logical devices:

sybdbs
syblogs
master
sybdbs2

(2) I use sp_helpdevice command to look into those 4 logical devices shown above, and find that those logical devices are in these physical devices:

/dev/rdsk/c0t0d0s1
/dev/rdsk/c0t3d0s4
d_master
/dev/rdsk/sybdbs2

(3) When I use sp_helpdevice to show all the physical devices, I see this:

device_name        physical_name                               description                                      status cntrltype device_number      low     high
------------------ ------------------------------------------- ------------------------------------------------ ------ --------- ------------- -------- --------
historydump        /export/home/syb11.dump/history.dump        disk, dump device                                  16       2           0              0        0
isproddump         /export/home/syb11.dump/isprod.dump         disk, dump device                                  16       2           0              0        0
istestdump         /export/home/syb11.dump/istest.dump         disk, dump device                                  16       2           0              0        0
master             d_master                                    special, physical disk, 100.00 MB                   2       0           0              0    51199
masterdump         /export/home/syb11.dump/master.dump         disk, dump device                                  16       2           0              0        0
modeldump          /export/home/syb11.dump/model.dump          disk, dump device                                  16       2           0              0        0
prodtestdump       /export/home/syb11.dump/prodtest.dump       disk, dump device                                  16       2           0              0        0
sybdbs             /dev/rdsk/c0t0d0s1                          special, default disk, physical disk, 2000.00 MB    3       0           3       50331648 51355647
sybdbs2            /dev/rdsk/sybdbs2                           special, physical disk, 1.00 MB                     2       0           5       83886080 83886591
syblogs            /dev/rdsk/c0t3d0s4                          special, physical disk, 850.00 MB                   2       0           4       67108864 67544063
sybscurty          /dev/rdsk/c0t3d0s5                          special, physical disk, 100.00 MB                   2       0           2       33554432 33605631
sybsecuritydump    /export/home/syb11.dump/sybsecurity.dump    disk, dump device                                  16       2           0              0        0
sybsystemprocsdump /export/home/syb11.dump/sybsystemprocs.dump disk, dump device                                  16       2           0              0        0
sysprocsdev        /dev/rdsk/c0t0d0s4                          special, physical disk, 100.00 MB                   2       0           1       16777216 16828415
tapedump1          /dev/rmt4                                   tape,        625 MB, dump device                   16       3           0              0    20000
tapedump2          /dev/rst0                                   disk, dump device                                  16       2           0              0    20000
uniface724dump     /export/home/syb11.dump/uniface724.dump     disk, dump device                                  16       2           0              0        0
uniface7dump       /export/home/syb11.dump/uniface7.dump       disk, dump device                                  16       2           0              0        0

(4) I want to know more about those physical devices. I use the df command to examine them:

df -k /dev/rdsk/c0t0d0s1    
df -k /dev/rdsk/c0t3d0s4    
df -k d_master    
df -k /dev/rdsk/sybdbs2

The df command complains that the first three devices are “not a block device, directory or mounted resource”.

On the other hand, the df command shows the following info for the last device:

Filesystem        kbytes   used  avail capacity Mounted on
/dev/dsk/c0t3d0s0 576558 371019 147889    71%   /

Seem like Unix doesn't know anything about those first 3 physical devices. Seem like they are something that only Sybase knows (someone suggested to me that they are "raw partitions"). The 4th device is something that Unix knows, and it is in "/dev/dsk/c0t3d0s0". Still, I cannot tell me which drive(s) those devices are on.

(5) When I use the mount command, I see this:

/            on /dev/dsk/c0t3d0s0 read/write/setuid on Mon Jul 6 11:10:46 2015
/usr         on /dev/dsk/c0t3d0s6 read/write/setuid on Mon Jul 6 11:10:46 2015
/proc        on /proc             read/write/setuid on Mon Jul 6 11:10:46 2015
/dev/fd      on fd                read/write/setuid on Mon Jul 6 11:10:46 2015
/tmp         on swap              read/write        on Mon Jul 6 11:10:49 2015
/export      on /dev/dsk/c0t3d0s7 setuid/read/write on Mon Jul 6 11:10:49 2015
/freespace   on /dev/dsk/c0t0d0s5 setuid/read/write on Mon Jul 6 11:10:49 2015
/sybase      on /dev/dsk/c0t0d0s0 setuid/read/write on Mon Jul 6 11:10:49 2015
/usr/openwin on /dev/dsk/c0t3d0s3 setuid/read/write on Mon Jul 6 11:10:49 2015

I cannot figure out the connection between the mounted devices above to the physical devices for the database-files and the transaction-files. I also cannot link the mounted devices above to the hard drives shown in the next section.

(6) When I use the cat /etc/vfstab command, I see these:

#device              device              mount         FS     fsck  mount    mount
#to mount            to fsck             point         type   pass  at boot  options
#
#/dev/dsk/c1d0s2     /dev/rdsk/c1d0s2    /usr          ufs    1     yes      -
/proc                -                   /proc         proc   -     no       -
fd                   -                   /dev/fd       fd     -     no       -
swap                 -                   /tmp          tmpfs  -     yes      -
/dev/dsk/c0t3d0s0    /dev/rdsk/c0t3d0s0  /             ufs    1     no       -
/dev/dsk/c0t3d0s6    /dev/rdsk/c0t3d0s6  /usr          ufs    1     no       -
/dev/dsk/c0t3d0s7    /dev/rdsk/c0t3d0s7  /export       ufs    2     yes      -
/dev/dsk/c0t0d0s5    /dev/rdsk/c0t0d0s5  /freespace    ufs    2     yes      -
/dev/dsk/c0t0d0s0    /dev/rdsk/c0t0d0s0  /sybase       ufs    2     yes      -
/dev/dsk/c0t3d0s3    /dev/rdsk/c0t3d0s3  /usr/openwin  ufs    2     yes      -
/dev/dsk/c0t3d0s1    -                   -             swap   -     no       -

# The following lines have been commented-out to allow Sybase to access these
# partitions and Raw Partitions.  Nov-24-1999
# /dev/dsk/c0t0d0s3  /dev/rdsk/c0t0d0s3  /master       ufs    2     yes      -
# /dev/dsk/c0t0d0s1  /dev/rdsk/c0t0d0s1  /sybdbs       ufs    2     yes      -
# /dev/dsk/c0t3d0s4  /dev/rdsk/c0t3d0s4  /syblogs      ufs    2     yes      -
# /dev/dsk/c0t3d0s5  /dev/rdsk/c0t3d0s5  /sybscurty    ufs    2     yes      -
# /dev/dsk/c0t0d0s4  /dev/rdsk/c0t0d0s4  /sybtemproc   ufs    2     yes      -

(7) When I use the format command, I see these two hard drives:

AVAILABLE DISK SELECTIONS:
 0. c0t0d0 <IBM-DNES-309170-SA30 cyl 11195 alt 2 hd 5 sec 320>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@0,0
 1. c0t3d0 <SEAGATE-ST34520N-1206 cyl 9004 alt 2 hd 4 sec 246>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0

(8) I don’t see any external device attached to the Sybase server. Having said this, there is a backup Sybase server, and the backup Sybase server has an external device attached to it (through a SCSI cable). At this point, I assume the database-files and transaction-files are all stored inside the Sybase server.

By the way, the Sybase server uses this Unix operating system:

SunOS <my-server-name> 5.4 Generic_101945-62 sun4m sparc

And the Sybase version is:

SQL Server/11.0.3.2/P/Sun_svr4/OS 5.4/SWR 7578 Rollup/OPT/Mon Nov  3 22:19:21 PST 1997

By the way, what I have tried so far to repair the database are:

• Tried dbcc checkalloc(, fix). Unfortunately, this command could not fix and could not complete.

• Tried drop-db/add-new-db/restore-db-from-backup. Unfortunately the restore failed to complete.

• Tried fsck-to-fix-the-devices. It could not complete and complained about “MAGIC NUMBER WRONG”.

• Tried Analyze-option-in-format-command-to-repair-all-disks, and then add-new-db and restore-db-from-backup. This method seemed to work. But after one week or so, I found a table has I/O error.

Please help me to determine which hard drive those database-files and transaction-files are stored, and whether they are in the same hard drive as the Unix operating system.

Thanks in advance.

Jay Chan

Best Answer

You have 2 physical disks: c0t0d0 and c0t3d0

devices: historydump, isproddump , istestdump, masterdump, modeldump, prodtestdump, sybsecuritydump,sybsystemprocsdump, uniface724dump, uniface7dump => /export => disk c0t3d0
device master => /master => disk c0t0d0
device sybdbs => disk c0t0d0
device sybdbs2 => /dev/rdsk/sybdbs2 => not sure : run "ls -l /dev/rdsk/sybdbs2" to see if it a symbolic link
device syblogs => disk c0t3d0
device sybscurty => disk c0t3d0
device sysprocsdev => disk c0t0d0

I advise you to look at the Solaris commands "prtdiag -v" and "iostat -En" (to be run as "root") to determine if there is any disk corruption.

hope this help. Vincent