Sunteți pe pagina 1din 2

dbcc checkdb vs dbcc checkstorage

Checkstorage will detect allocation errors, it is a reasonable substitute for dbcc checkalloc (checkstorage will report a fair number of issues that checkalloc will not, many of them trivial things, and checkalloc may be able to detect a few odd conditions checkstorage does not. What checkstorage wont catch are issues with index tree (keys out of order, index entries that point to missing rows, rows that are not indexed). So checkstorage is not a good substitute for checkdb.

What is locking and how many types of locking in SYBASE ASE?


Whenever any kind of operation performs in tables, SYBASE ASE implements a locking scheme in that table. So that other operation could not affect current operation and consistency of data in that table. While locking prevent another processes from accessing process data which some time leading blocking and deadlock.

Locking scheme affects tables in SYBASE ASE in three ways. 1. Row level Locking 2. Page Level Locking 3. Table/All page Level Locking Datarows locking which locks only the data rows.Index rows and pages are not locked. Datapages locking which locks only the data pages. Allpages locking which locks datapages and index pages.

Page / Row level locking

There are three type of lock is made on page/row level locking : 1.Shared locks Shared lock is applied in a table for read operation . Many read transaction can be perform in a table or page while data modification will not allowed during shared lock.Data modification transaction wait for release existing shared lock. 2.Exclusive locks Exclusive lock applies during data modification. When a transaction acquire exclusive lock , no other transaction can acquire exclusive lock.Other transaction wait for releasing existing exclusive lock. 3.Update locks Initial phase of data modification, ASE applies update lock in a data. Update lock allow for shared lock, while does not allow for exclusive lock.

Table level Locking

1.Intent lock If any transaction is performing with page-level and row-level lock, and it require other row/page level lock for completion of transaction. Adaptive Server applies an intent table lock with each shared or exclusive page or row lock. 2.Shared lock similar to a shared page or row lock, except that it affects the entire table. A create nonclustered index command also acquires a shared table lock. 3.Exclusive lock similar to an exclusive page or row lock, except that it affects the entire table.

What is the difference between login and user?


login: is defined at the server level. Which is used to get access on the server. By default it routes the user to master database if default database has not been defined at the time of login creation. user is defined at the database level. To access database objects on the user defined database we need to have user created on the given database. Note: Most of the time login and user gets created by the same name, which creates confusion that user is able to login to server, still not able to access table or stored procedure. In this case user has to ensure two things. 1: Whether user exists, for the give login, in the given database or not. If not then first gets it created. 2: If user also exists then needs to check permissions on database objects for the given user.

S-ar putea să vă placă și