SQL 2000 Tutorial

  • View

  • Download

Embed Size (px)

Text of SQL 2000 Tutorial

  • 8/6/2019 SQL 2000 Tutorial


    SQL Server provides an effective method for adding users in SQL Server and for managingdata and information so that it can easily be stored and retrieved from the underlying files inorder to provide the functionality it is designed for.

    Once the database is designed, configured and implemented, it is critical that you startadding users in SQL Server so that people needing access to the data or specific bits ofdata be granted access to what they need to be able to access.

    This is increasingly important as the need for more secure practices, guidelines and policiesbecomes a greater force in the workplace. Security has become more prevalent in the day-to-day operations of practically every organization in the world.

    So how can SQL Server and its built in security allow for a more secure organization andhelp to protect the data that we are trying to guard?

    Working with SQL Server and the security it has within it is a critical component of databaseadministration. Adding users in SQL Server is an important task.

    When adding users in SQL Server, it provides three methods of authenticating users withinthe database that can be implemented in order to control how users are granted access tothe database.

    These three methods are windows authentication, SQL Server authentication and mixed-mode authentication.

    Windows authentication performs a check of the user credentials with a network validationto ensure that the user has access to the resource.

    SQL Server authentication requires a valid SQL Server login name and passwordcombination to validate the user access against the database before granting access to theresources on the server.

    Mixed mode security will allow the user to connect to the database via a valid Windowsaccount or through a valid SQL Server login. The type of security you implement dependson the type of security architecture you decide is best for your specific needs on the serverand the network.

    In order to configure security in SQL Server, the administrator may have to use not onlytools within SQL Server but must also work with network accounts in order to grant accessand adding users in SQL Server correctly.

    In order to view the logins that are used and defined within SQL Server using EnterpriseManager, select the Security node within Enterprise Manager. The Logins node withinSecurity will allow you to view the logins defined within that database.

    The illustration below shows the screen and the information that it will provide anyone wholooks at it.

  • 8/6/2019 SQL 2000 Tutorial


    The first column is the name of the login as it is known by the database. The type column isnext and depicts what type of login it happens to be within the database.

    The following column tells whether or not the login has access to the server. This is theServer Access column.

    The next two columns deal with default settings for the user within the server. Thesesettings deal with the database that serves as the default database for that login and thedefault language that is associated with that account.

    In order to edit a login in SQL Server double-click on the login or right click and selectProperties. Doing so will bring up the following dialog:

  • 8/6/2019 SQL 2000 Tutorial


    The General tab deals with the type of authentication to use for the login as well as settingthe default database and language for that login.

    If Windows authentication is chosen, a domain must be selected and then the securityaccess should be either granted or denied to the login.

    If SQL Server authentication is chosen, the password should be entered. Click OK to saveany changes. The dialog also contains a tab to allow the administrator to define the serverroles for the login (Server Roles).

    The following illustration shows this tab:

  • 8/6/2019 SQL 2000 Tutorial


    The server roles can be selected and then click OK to save the changes. Each role hasspecific rights within the server and in order to understand what the login should be

    associated with, the roles should be understood by those assigning them.

    The final tab on the dialog is the Database Access tab. The following illustration shows thistab:

  • 8/6/2019 SQL 2000 Tutorial


    This tab will allow the administrator to select each database within the SQL Server andspecify the database roles within that database.

    These roles can grant and/or deny various capabilities within the databases for thatparticular login. Some examples of these roles include a data writer role, which will allow theuser to update and insert data into the database and a data reader roles that allows theuser to query the database in order to view the data.

    Users can also be added to individual databases by expanding the database in questionand then selecting the Users node. The following illustration shows this screen:

  • 8/6/2019 SQL 2000 Tutorial


    In order to access the properties for a particular user, double click that user or right clickand select Properties from the popup menu. This will bring up the following dialog in orderto manage the permissions assigned to that particular user account.

  • 8/6/2019 SQL 2000 Tutorial


    The Permissions button will bring up the dialog to allow the administrator to grant or allowaccess to specific objects within the database. The following dialog shows this portion of theprocess:

  • 8/6/2019 SQL 2000 Tutorial


    By selecting and deselecting specific options within this dialog, the administrator can assignand deny access to certain objects within the database.

    Different object types will have different operations that can be executed against them as

    can be seen in the illustration above.

    For example, tables and views can have Select, Insert, Update, Delete and others whilestored procedures do not have these operations.

    The Columns button applies to views and tables and can be used to control what columnsthat user has access to within the database.

    This level of control can help to make a database extremely secure, but can cause issuesfor those who are not familiar with the security that has been architected for a particulardatabase or a server. Once the changes have been made to the user, they can be saved byclicking the Apply button.

    Hopefully, you now have a better understanding of how to adding users in SQL Server andhow to work with security within SQL Server, as well as setting up a secure databaseenvironment in order to protect your data and your information that can prove to be vital tothe success of your business.

  • 8/6/2019 SQL 2000 Tutorial


    Moving Database

    If you need moving the database to another location, the attach and detach functionality isindispensable.

    As many of you may or may not know, SQL Server is a database management system usedto store data and objects needed to work with that data.

    It is one of many products on the market designed for this purpose. SQL Server works byallowing the user to specify a location on the physical drives accessible by the server andproviding the engine needed to store, retrieve, organize and utilize the data and objectswithin the database.

    The database is stored in files on hard drives that are accessed in order to gain access tothe contents of the database. The files associated with a database have a default location,but upon database creation, they can be configured to go to another location.

    This allows for data to be better configured and organized across hard drives that may havelimited space available for data storage. What happens however, when a file needs to beincorporated into the database management system from an external source?

    This is where the concept of moving the database by attaching and detaching comes intoplay.

    When a database is used and managed by SQL Server, the data files on the hard drivesassociated with that database are locked to use by any other application.

    If you try to access that file, a message will alert you to the fact that the file is being used byanother application and you cannot access it. This makes the possibility of moving adatabase from one location to another or copying the database for use by another agencyout of the question.

    For example, if you were traveling to another location to work on an application and you hadto work from a machine that did not have access to that database, you could take a copy ofthe database to use to work with.

    This is where the ability to attach and detach a database will come into play. You candetach a database in order to remove it from the control of SQL Server and enable the filesto be accessed by external methods or applications.

    This is where the concept of detaching a database can be used. By detaching a database itcan be copied and moved to another location without interference from the SQL Servermanaging that database.

    Detaching a database in Enterprise Manager can be accomplished by the following:

    1. Right-click on the database in question. This will bring up menu options shown below:

  • 8/6/2019 SQL 2000 Tutorial


    After brining up the menu options, go to the Detach Database option under the All Tasksmenu option as illustrated below:

    Select the Detach Database option to begin detaching the database from the databasemanagement system. After selecting the Detach Database option the following screen will

    appear to confirm the detach operation:

  • 8/6/2019 SQL 2000 Tutorial


    This screen informs the user of the number of active connections to the database.

    This can