Thursday, May 30, 2013

SQL DBA reference websites

Hi Viewers,

Below are the sites for SQL DBA reference which i am using:

http://www.careerride.com/SQL-DBA-different-types-of-BACKUPs.aspx
http://www.sqldbadiaries.com/
http://www.sql-server-helper.com/
http://strictlysql.blogspot.in/2010/06/finding-cpu-utilization-in-sql-server.html
http://www.sqlmag.com/articles/sqlserverdenali/sql-server-denali-alwayon-140199
http://beyondrelational.com/blogs/community/archive/2011/12/21/sql-server-2012-denali-alwayson.aspx
http://insqlserver.com/
http://www.a2zmenu.com/Blogs/SQL/store%20procedure%20to%20take%20database%20backup.aspx
http://www.jamesserra.com/archive/2012/02/sql-server-2012-denali-t-sql-enhancements/
http://www.mytechmantra.com
http://sqlwithmanoj.wordpress.com/tag/t-sql-interview-questions/
http://www.sql-server-citation.com/2007/08/resource-for-new-sql-server-dba-and.html
http://www.sqlcourse.com/intro.html
http://sqlserver2008tutorial.com/member.html
http://dba.fyicenter.com/faq/sql_server/
http://www.careerride.com/SQLServer-Interview-Questions.aspx
http://www.mssqltips.com/sql-server-tip-category/53/dba-best-practices/
http://learnsqlwithbru.com/sql-server-interview-questions-and-answers/sql-server-dba-q-and-a/
http://www.sqlmonkeys.com
http://www.bradmcgehee.com/2010/03/an-introduction-to-sql-server-2008-audit/
http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/06/06/getting-log-space-usage-without-using-dbcc-sqlperf.aspx
http://sqldbachronicles.blogspot.in/2011/05/check-log-space-dbcc-sqlperflogspace.html
http://dbaspot.com/microsoft-sql-server/
http://sql-school.blogspot.in/
http://arshadali.blogspot.in/
http://www.blackwasp.co.uk/SQLProgrammingFundamentals.aspx
http://vblvbl.brinkster.net/SQL7DI/ch12c.htm
http://www.sqlserver-training.com/sql-server-2008-interview-questions/-
http://www.sqlvillage.com/Interviews/Inerview%20Questions%20-%20Part%202.asp
http://www.slideshare.net
http://www.mssqltips.com/sqlservertip/1253/sql-server-dba-concurrency-and-locking-interview-questions/
http://sqlserverplanet.com/
http://sqlserverpedia.com/wiki/Database_Administration
http://www.mssqlfix.com/2011/02/mcitp-70-450-exam-sample-question-and.html
http://sql-server-2005.com/
http://www.sql-dba.com/sql_server_scripts.html
http://www.databasetimes.com/2009/05/keep-up-indexes-in-sql-server-2005.html
http://www.sqllion.com/2009/07/sql-server-indexes-pros-and-cons-part-2/
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=37037#top
http://www.sqlserverblogforum.com/
http://www.databasejournal.com/features/mssql/archives/
http://www.reference.com/motif/computers/difference-between-a-database-instance-and-schema


Backup and Restore
http://www.sqlbackuprestore.com/speedinguprestores.htm


upgrade sql2000 to sql2005:
http://www.sqlservercentral.com/articles/Administration/2988/   
http://www.sqlservercentral.com/articles/News/3036/         
http://gouravverma.blogspot.in/2008/04/top-10-new-features-in-sql-server-2005.html

SQL Server 2008:
http://sqlcat.com/sqlcat/b/top10lists/archive/2009/01/30/top-10-sql-server-2008-features-for-the-database-administrator-dba.aspx
http://blog.sqlauthority.com/sql-server-interview-questions-and-answers/

SQL Programming:
http://beginner-sql-tutorial.com/sql.htm
www.sqlserver2005tutorial.com/
http://dba.fyicenter.com/faq/sql_server/


Cluster:
http://clearinglogfiles.blogspot.in/2012/03/cluster-problems_3942.html

SSRS:
http://www.katieandemil.com/ssrs-create-reports-a-simple-example-of-ssrs-report

Certification:
http://www.ucertify.com/certifications/Microsoft/mcitp-database-admin-sql-server-2008.html
http://braindumps.org/
Exam: 70-432
Exam: 70-433
Exam: 70-450
Exam: 70-451
http://www.sql-training.net/

SQL SERVER 2012:
http://www.mssqltips.com/sql-server-tip-category/117/sql-server-denali/
http://www.mssqltips.com/sql_server_dba_tips.asp
http://social.technet.microsoft.com/wiki/contents/articles/3783.what-s-new-in-sql-server-2012-en-us.aspx
http://www.infosysblogs.com/microsoft/2012/03/sql_server_2012_-_overview.html#more
http://www.sqlskills.com/T_MCMVideos.asp
http://www.sqlserver-training.com/what-is-contained-database-in-sql-server/-
http://www.devproconnections.com/article/sqlserverdenali/sql-server-denalis-security-enhancements-140479
http://www.yourdba.com/?p=123
http://sql-server-tuning.com/2011/11/06/sql-server-2012-availability-enhancements-part-ii/
http://www.simple-talk.com/sql/database-administration/sql-server-2012-alwayson/

Tutorial:
http://www.infotechguyz.com/SQLServer2012Tutorial.html

Ebook:
http://www.andreavb.com/forum/viewtopic_9981.html

Interview:
http://www.mssqltips.com/sqlservertip/1472/sql-server-dba-phone-interview-questions/
http://www.sqlserver-expert.com/search/label/TempDB
http://interviewquestions4u.com/database/sql-server/sql-server-dba
http://www.mssqlfix.com/2010/11/sql-dba-interview-questions-with.html
https://www.logicsmeet.com/forum/35808-sql-server-interview-questions-and-answers-for-experienced.aspx
http://www.mssqltips.com/sql-server-tip-category/46/interview-questions-dba/
http://www.careerride.com/SQLServer-Interview-Questions.aspx#sql16
http://www.careerride.com/Online-practice-test.aspx

Websites for SQL DBA:
http://www.mssqltips.com/sqlservertip/948/sql-server-websites/
www.dba-24x7.com/sql-server-services.php


Indexes:
http://msdn.microsoft.com/en-us/library/ms175049.aspx
http://www.simple-talk.com/sql/learn-sql-server/sql-server-index-basics/
http://www.codeproject.com/Articles/39006/Overview-of-SQL-Server-2005-2008-Table-Indexing-Pa
http://www.sqllion.com/2009/07/sql-server-indexes-pros-and-cons-part-2/


Wednesday, May 22, 2013

How to Recover Database from Suspect Mode in SQL Server

Database in Suspect Mode reasons:

1. When records are inserted (it could be bulk inserts through Stored Procedure) in Application Database from application web form, if power failure on the Database Server Machine occurs during at that time , will there be chances of data corruption for those specific database records.

2. When records are inserted (it could be bulk inserts through Stored Procedure) in Application Database from application web form, if someone stops the SQL SERVER Database Engine Service, will there be chances of data corruption for those specific database records.


3. When the data files are not available. 

Solution:
1. Restore the database backup file.

2. If no backup is available, then run the following commands

   ALTER DATABASE Databasename SET EMERGENCY
   DBCC CHECKDB 'Databasename'
   ALTER DATABASE Databasename SET SINGLE USER with ROLLBACK IMMEDIATE
   DBCC CHECKDB 'Databasename, REPAIR_ALLOW_DATA_LOSS'
   ALTER DATABASE Databasename SET MULTIUSER

Sunday, May 19, 2013

Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe" /noconfig /fullpaths

Hi Team,

While performing patching SQL server 2008 R2 SP2 CU6 on an Active/Active cluster having two nodes e.g. Node1 and Node2, I encountered an unusal error which indicates:

SQL Server Setup has encountered the following error:

Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\Users\uswal.dba.va_c\AppData\Local\Temp\-euzaneo.cmdline".

Error code 0x84B10001.



Solution:

1. Start installing the SQL Server 2008 R2 Cumulative Update, by clicking on setup. It will start    
    the extraction of files to a shared disk where there is large amount of Disk space.
2. Once extraction is complete, manually copy the extracted files (check the latest timestamp) to 

    the C drive ( Non clustered disk).
3. Cancel the current installation which is in progress.
4. Start installation again by clicking the setup.exe from C drive , where you have manually 

    copied the extracted files. 

Thursday, May 2, 2013

SQL Server: Database Basics

System Databases
  1. Master: composed of system tables that keep track of server installation as a whole and all other databases that are eventually created. Master DB has system catalogs that keep info about disk space, file allocations and usage, configuration settings, endpoints, logins, etc.
  2. Model: template database. Gets cloned when a new database is created. Any changes that one would like be applied by default to a new database should be made here
  3. Tempdb: re-created every time SQL Server instance is restarted. Holds intermediate results created internally by SQL Server during query processing and sorting, maintaining row versions, etc. Recreated from the model database. Sizing and configuration of tempdb is critical for SQL Server performance.
  4. Resource [hidden database]: stores executable system objects such as stored system procedures and functions. Allows for very fast and safe upgrades.
  5. MSDB: used by the SQL Server Agent service and other companion services. Used for backups, replication tasks, Service Broker, supports jobs, alerts, log shipping, policies, database mail and recovery of damaged pages.
Database Files
  1. Primary data files: every database must have at least one primary data file that keeps track of all the rest of the files in the database. Has the extension .mdf.
  2. Secondary data files: a database may have zero or more secondary data files. Has the extension .ndf.
  3. Log files: every database has at least one log file that contains information necessary to recover all transactions in a database. Has the extension .ldf.
Creating a Database
  1. New user database files must be at least 3 MB or larger including the transaction log
  2. The default size of the data file is the size of the primary data file of the model database (2 MB) and the default size of the log file is 0.5 MB
  3. If LOG ON is not specified but data files are specified during a create database, the size of the log file is 25% of the sum of the sizes of all the data files.
Expanding or Shrinking a Database
  1. Automatic File Expansion:
  1. The file property FILEGROWTH determines how automatic expansion happens
  2. File property MAXSIZE sets the upper limit on the size
  • Manual File Expansion: use the ALTER DATABASE command with the MODIFY FILE option to change the SIZE property to increase the database file size
  • Fast File Initialization: adds space to the data file without filling the newly added space with zeros. New disk content is overwritten as new data is written to the files. Security is managed through Windows security setting SE_MANAGE_VOLUME_NAME
  • Automatic Shrinkage:
    1. Same as doing DBCC SHRINKDATABASE (dbname, 25). Leave 25 % free space in the database after the shrink
    2. Thread performs autoshrink as often as 30 minutes, very resource intensive
  • Manual Shrinkage: use DBCC SHRINKDATABASE if you want to shrink.
  • I highly recommend not to shrink the database.

  • Filegroups
    1. Can group data files for a database into filegroups for allocation and administration purposes.
    2. Improves performance by controlling the placement of data and indexes into specific filegroups on specific drives or volumes.
    3. Filegroup containing the primary data file is called the primary filegroup, there is only one primary filegroup.
    4. Default filegroup: there is at least one filegroup with the property of DEFAULT, can be changed by DBA.
    5. Use cases when -not- to use filegroups:
    1. DBA might decide to spread out the I/O for a database: easiest way is to create a database file on a RAID device.
    2. DBA might want multiple files, perhaps to create a database that uses more space than is available on a single drive: can be accomplished by doing CREATE DATABASE with a list of files on separate drives
  • Use cases when you want to use filegroups:
    1. DBA might want to have different tables assigned to different drives or to use the table and index partitioning feature in SQL Server.
  • Benefits:
    1. Allows backup of parts of the database.
    2. Table is created on a single filegroup, allows for backup of critical tables by backing up selected filegroups.
    3. Same for restoration. Database can be online as soon as primary filegroup is restored, but only objects on the restored filegroups will be available.


    Wednesday, May 1, 2013

    During the SQL Server Service Pack installation, "Consistency validation for SQL Server registry keys" failed.

    Description:

    Issue: Installation of SQL Express 2008 fail with the error: "Consistency validation for SQL Server registry keys" failed

    Error:
    Rule "Consistency validation for SQL Server registry keys" failed
    The SQL Server registry keys from a prior installation cannot be modified. To Continue; see SQL Server Setup documentation about how to fix registry keys.

    Solution-1:

    Navigate to:
    %ProgramFiles%\Microsoft SQL Server\100\Setup Bootstrap\Log

    Search (in Detail_GlobalRules.txt) for lines containing:
    "could not fix registry key"

    Run regedit

    Set full control permissions for the appropriate registry keys mentioned in "Detail_GlobalRules.txt" file.

    Re- run the installation.


    Solution-2

    Steps
    1. Located HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server in registry
    2. Right click and go to Permission
    3. Click on Advance
    4. Tick on both check box
         I. Inherit from parent the permission...
        II. Replace permission entries on all child objects..., click OK
    5. Click OK again