Search This Blog

Monday 6 January 2014

Msg 10351, Level 14, State 1 (error in sybase)

Problem-

Msg 10351, Level 14, State 1:
Server 'LRL3855':
Server user id 4 is not a valid user in database 'dxpo'
Msg 4001, Level 11, State 1:
Server 'LRL3855':
Cannot open default database 'dxpo'.

Resolution-

Newly set up a database using below commands

1> disk init name="dxpo",
2> physname="d:\sybase\data\dxpo",
3> size = 17380
4> go
00:00000:00027:2014/01/06 15:05:25.54 kernel  Initializing virtual device 4, 'd:\sybase\data\dxpo' with dsync 'on'.
00:00000:00027:2014/01/06 15:05:25.54 kernel  Virtual device 4 started using asynchronous i/o.
1> create database dxpo on dxpo="15000M"
2> go
CREATE DATABASE: allocating 17152 logical pages (33.5 megabytes) on disk 'dxpo'.
Database 'dxpo' is now online.

1> sp_helpdb
2> go
 name           db_size       owner dbid  created      status
 -------------- ------------- ----- ----- ------------ --------------------------------------------------------------------
 dxpo                 33.5 MB sa        5 Jan 06, 2014 mixed log and data
 master               13.0 MB sa        1 Jan 03, 2014 mixed log and data
 model                 3.0 MB sa        3 Jan 03, 2014 mixed log and data
 sybmgmtdb            75.0 MB sa        4 Jan 03, 2014 select into/bulkcopy/pllsort, trunc log on chkpt, mixed log and data
 sybsystemdb           4.0 MB sa    31513 Jan 03, 2014 trunc log on chkpt, mixed log and data
 sybsystemprocs      132.0 MB sa    31514 Jan 03, 2014 trunc log on chkpt, mixed log and data
 tempdb                4.0 MB sa        2 Jan 06, 2014 select into/bulkcopy/pllsort, trunc log on chkpt, mixed log and data

create login for the newly created database

D:\>isql -Usa -P -w9999
1> use dxpo
2> go
1> sp_addlogin 'podbo','scooter',dxpo
2> go
Password correctly set.
Account unlocked.
New login created.
(return status = 0)

D:\>isql -Upodbo -Pscooter -w9999
Msg 10351, Level 14, State 1:
Server 'INBLRL3855':
Server user id 4 is not a valid user in database 'dxpo'
Msg 4001, Level 11, State 1:
Server 'INBLRL3855':
Cannot open default database 'dxpo'.

Add user name in newly created database using sa role.

D:\>isql -Usa -P -w9999 -SINBLRL3855

1> use dxpo
2> go
1> sp_adduser 'podbo','dxpo'
2> go
New user added.
(return status = 0)
1> exit

D:\>isql -Upodbo -Pscooter -w9999 -SLRL3855
1> select db_name()
2> go

 ------------------------------
 dxpo

(1 row affected)