Tables When you click a Tables node, the right pane of SQL Server Enterprise Manager showsall of the tables in the current database, as you can see Figure 9.11.. FIGURE 9.11Listing of ta
Trang 1• New maintenance plan
• Maintenance plan history
• Backup database
• Restore database
• Truncate log
• Shrink database
• Modify data file sizes
• Modify log file sizes The Table Info page of the taskpad lists all of the tables and indexes within thedatabase For each table, this page also shows the number of rows of data that thetable currently contains A bar graph shows you the amount of space occupied byeach table and index
The Wizards page of the taskpad offers another way to invoke any of the SQLServer Wizards
From any database node, you can perform common database tasks by using theshortcut menu These include:
• Create a new database
• Create new database objects
• Delete an existing database
• Copy subscription database
• View replication conflicts
Trang 2NOTE You’ll learn more about databases in Chapter 10.
Diagrams
When you click a Diagrams node, the right pane of SQL Server Enterprise Managershows all of the database diagrams that have been created for the database A singledatabase might have no database diagrams, a single database diagram, or multiple data-base diagrams representing its structure Double-clicking a database diagram will open it
in the database diagram designer
From the Diagrams node, you can create and delete database diagrams You cancreate new database diagrams with the node’s shortcut menu, and you can deletedatabase diagrams with the individual diagram’s shortcut menu This is typical ofhow all the objects in Enterprise Manager work
NOTE You’ll learn more about database diagrams in Chapter 11
Tables
When you click a Tables node, the right pane of SQL Server Enterprise Manager showsall of the tables in the current database, as you can see Figure 9.11 For each table,SQL Server Enterprise Manager lists the table name, the owner name, the type of table(System or User), and the date on which the table was created
Trang 3FIGURE 9.11
Listing of tables in SQL Server Enterprise Manager
From the Tables node, you can create and delete tables, as well as import andexport data
Double-clicking a table opens the property sheet for that table By right-clicking atable, you can perform other table operations:
• Design table
• Rename table
• Delete table
• Copy table
• Open table (all rows or top n rows)
• Open query based on the table
Trang 4• Add a full-text index to the table
an object This dialog box (shown in Figure 9.12) tells you which objects the selectedtable depends on and which objects depend on the selected table Both direct andindirect dependencies are shown For example, in Figure 9.12, the CustOrderHiststored procedure has a sequence of 2, indicating that it depends on another objectthat depends directly on the Orders table Checking the Show First Level DependencyOnly box will limit the display to objects that have a sequence of 1
FIGURE 9.12
The Dependencies dialog box
Trang 5NOTE You’ll learn more about tables in Chapter 11.
Views
If you select a Views node in SQL Server Enterprise Manager, the right-hand pane willdisplay a list of all the views in the current database, along with their owner, type,and creation date Figure 9.13 shows this list for a typical database
FIGURE 9.13
Views in SQL Server Enterprise Manager
From the Views node, you can create new views and delete existing views You canalso choose to hide some of the columns that are normally shown for each view.The shortcut menu for individual views lets you perform basic operations:
• Design view
• Open view (all rows or top n rows)
• Open query based on the view
• Delete view
• Copy view
• Rename view
Trang 6• Manage triggers
• Manage permissions
• Generate SQL scripts
• Display dependenciesDouble-clicking a view will open the property sheet for the view On the propertysheet, you can modify the permissions for the view, check the syntax of the view, oreven change the SQL statement that creates the view Figure 9.14 shows the propertysheet for a view
Trang 7FIGURE 9.15
Stored procedures in SQL Server Enterprise
Manager
From the Stored Procedures node, you can create new stored procedures and deleteexisting stored procedures You can also choose to hide some of the columns that arenormally shown for each stored procedure
The shortcut menu for individual stored procedures lets you perform basic operations:
• Copy stored procedure
• Delete stored procedure
• Rename stored procedure
• Manage permissions
• Create new publication
• Generate SQL scripts
• Display dependenciesDouble-clicking a stored procedure will open the property sheet for that stored pro-cedure, which includes the SQL statements that make up the stored procedure, as well
as the ability to edit permissions and check syntax
Trang 8NOTE SQL Server Enterprise Manager does not provide a way to display any rows thatmight be retrieved by a stored procedure.
You’ll learn more about stored procedures in Chapter 14
Users
If you click a Users node, you’ll see a list of all the users for the current database Users
are specific to a database (unlike logins, which apply to entire servers) and are thebasis for permissions within a database As you can see in Figure 9.16, the user listshows the name, associated login name (if any), and whether that user is permitted inthe database
Clicking a Roles node will show you a list of all the roles in the current database Roles
are another part of the SQL Server security mechanism They allow you to managepermissions for groups of users rather than for individual users There are two types ofroles: application roles (designed for client-side validation of user identity) and stan-dard roles (containing SQL Server users) Figure 9.17 shows a typical list of roles
Trang 9FIGURE 9.17
List of roles in SQL Server Enterprise Manager
From the Roles node itself, you can create and delete roles Double-clicking a roleshows you the properties of that role, including the users in the role and the permis-sions that they are assigned
NOTE You’ll learn more about roles in Chapter 18
Rules
Clicking a Rules node will show you all the rules in the current database Rules are
conditions expressed in T-SQL syntax (for example, @salary < 20000) that can beused to limit the data contained in columns of a table
TIP You usually won’t find any rules in SQL Server 2000 databases Rules are now sidered to be obsolete and have been largely replaced by constraints
con-You’ll find further information about rules in Chapter 4
Trang 10If you click a Defaults node, the right-hand pane of SQL Server Enterprise Managerwill show you all the defaults in the current database Figure 9.18 shows such a list ofdefaults
FIGURE 9.18
Defaults in SQL Server Enterprise Manager
A default is a default value that can be attached to one or more table columns for
use when a value is not explicitly supplied for that column in a new row of the table
From the Defaults node, you can create and delete defaults Double-clicking anindividual default will show you the properties for that default
TI P Like rules, defaults are largely obsolete For the most part, you should use defaultconstraints instead of defaults in your database designs
There’s further information on defaults in Chapter 4
User Defined Data Types
When you click a User Defined Data Types node, SQL Server Enterprise Managershows you all of the user-defined datatypes in the current database You can think ofuser-defined datatypes as aliases for built-in datatypes Figure 9.19 shows the user-defined datatypes in a typical database
Trang 11You can use the shortcut menu for a user-defined datatype to perform basic tions on the user-defined datatype:
NOTE You’ll learn more about user-defined datatypes in Chapter 11
User Defined Functions
When you click a User Defined Functions node, SQL Server Enterprise Manager showsyou all of the user-defined functions in the current database User-defined functionsprovide callable subroutines for T-SQL code
You can use the shortcut menu for a user-defined function to perform basic tions on the user-defined function:
NOTE User-defined functions are covered in more detail in Chapter 5
Full-Text Catalogs
When you click a Full-Text Catalogs node, SQL Server Enterprise Manager shows you
in its right-hand pane a list of all full-text catalogs in the current database
Trang 12From a Full-Text Catalogs node, you can create, repopulate, rebuild, or remove allcatalogs The individual full-text catalog nodes let you perform these operations for anindividual catalog, as well as modify the schedule for automatic operations Double-clicking a full-text catalog object will show you all the properties for that catalog.
TI P You’ll find a Full-Text Catalogs node only if the server has had full-text indexingenabled
You can find more information on Full-Text Search in Chapter 6
Pull Subscriptions
When you click a Pull Subscriptions node, SQL Server Enterprise Manager shows you
all of the pull subscriptions for the current database A pull subscription is a replication
task that pulls in data from another server to the current database
From a Pull Subscriptions node, you can create a new pull subscription or delete anexisting subscription You can also view any replication conflicts in this database’ssubscriptions
Individual pull subscriptions let you perform basic replication operations: viewconflicts, reinitialize, synchronize or stop synchronizing, and view the job history
Double-clicking a pull subscription will open the property sheet for that subscription
TIP You’ll find a Pull Subscriptions node only if the database is subscribing to any cated publications via pull subscriptions
repli-You’ll learn about replication in Chapter 27
The Data Transformation Services Folder
Each SQL Server has a Data Transformation Services folder in the SQL Server
Enter-prise Manager tree Data Transformation Services (DTS) is a component of SQL Server
that can perform complex import and export operations from a variety of datasources (not just SQL Server data sources, but any OLE DB data sources) Within thisfolder, you’ll find three nodes:
• Local Packages
• Meta Data Services Packages
Trang 13NOTE You’ll learn more about Data Transformation Services in Chapter 22.
Local Packages
A DTS package is a set of instructions for SQL DTS These instructions might specify,
for example, a data source and a data destination together with the steps necessary totransform data from the source to the destination
The Local Packages node shows all of the DTS packages that are stored on the localSQL Server The shortcut menu for a package will let you design the package, executethe package, or schedule it for later execution
Figure 9.20 shows a local package open in the DTS Package Designer This lar package exports data from a SQL Server database to a text file
particu-FIGURE 9.20
The DTS Package Designer
Meta Data Services Packages
DTS packages may also be stored in a Meta Data Services database—if you click theMeta Data Services Packages node, you’ll see these packages Meta Data Services is anobject-oriented repository that’s designed to be used by many applications to storemetadata Meta Data Services is primarily a modeling tool, optimized for use by tools
Trang 14and development applications A Meta Data Services database holds objects thatexpose interfaces and can be extended through the use of information models.
Meta Data Services is an advanced topic that we don’t cover in this book If you’veinstalled SQL Server, you can find the complete Meta Data Services documentation inBooks Online under the Meta Data Services node
NOTE The previous version of Meta Data Services was known as the Microsoft Repository
Meta Data
The Meta Data node holds a taskpad that lets you browse the information stored inthe local repository This interface, shown in Figure 9.21, lets you view informationabout databases, tables, columns, and so on You can easily jump from the informa-tion on a particular column to any DTS packages that use that column
FIGURE 9.21
Browsing repository metadata in SQL Server Enterprise Manager
Trang 15The Management Folder
Each SQL Server in SQL Server Enterprise Manager contains a Management folder.This is the folder that provides access to traditional database administrator informa-tion, including:
• Locks per process ID
• Locks per object
• Database maintenance plans
• SQL Server logsFigure 9.22 shows this portion of the SQL Server Enterprise Manager tree
The SQL Server Agent node is primarily a container for the objects managed by the
SQLServerAgent service SQLServerAgent is a separate component of SQL Server that’s
Trang 16responsible for managing alerts, jobs, and operators, and there are nodes of the treeunderneath the SQL Server Agent node for each of these objects.
From the SQL Server Agent node itself, you can start and stop the SQLServerAgentservice, or create a new operator, job, or alert You can also view the SQLServerAgenterror log, or make this a master or target server for multiserver administration
N OTE The SQLServerAgent error log contains only errors directly related to theSQLServerAgent service, not to the operation of SQL Server as a whole
When you click an Alerts node, SQL Server Enterprise Manager shows you in the
right-hand pane a list of all alerts configured on the current server An alert is a condition
that SQLServerAgent can respond to (for example, an error of a particular severity),together with an action SQLServerAgent should take if the alert’s condition occurs(for example, to run a particular job) The list of alerts lets you see how often eachalert has occurred, as well as which alerts are configured to send notification by e-mail, pager, or Net Send
From the Alerts node, you can create and delete alerts, or generate SQL scripts foralerts The shortcut menu for an individual alert lets you refresh the statistics dis-played for that alert or generate a SQL script for the alert Double-clicking an alertopens the property sheet for that alert
When you click an Operators node, SQL Server Enterprise Manager shows you a list
of all operators for the current server
An operator is a user who should be notified in the case of certain alerts From the
Operators node, you can create and delete operators, or generate SQL scripts Theshortcut menu for an individual object lets you refresh the information for that oper-ator, which includes the operator name and the last time that operator was notified ofany alert Double-clicking an operator opens the property sheet for that operator
When you click a Jobs node, SQL Server Enterprise Manager shows a list of all jobs
on the server A job is a set of actions that SQLServerAgent can run in response to
alerts or on a schedule For each job, SQL Server Enterprise Manager displays the jobname, category, whether the job is enabled and currently able to be run, whether thejob is scheduled, its current status, and the last and next run dates
From a Jobs node, you can create and delete jobs, modify the list of job categories,and create SQL scripts for local jobs The shortcut menu for individual job objectsgives you complete control over jobs:
Trang 17NOTE For more information about alerts, operators, and jobs, see Chapter 17.
Backup
When you click a Backup node, SQL Server Enterprise Manager displays information
on all backup devices known to the current database A backup device is a tape drive or
a disk file that can be used to hold a backup copy of a database
From a Backup node, you can create and delete backup devices, as well as create anactual backup job to run immediately or on a scheduled basis The shortcut menu on
a backup device lets you run a backup
Trang 18FIGURE 9.23
Monitoring current process information
For each process, the Process Info node shows the following information:
• Process ID (this is the unique ID that SQL Server assigns to each process when
it’s started—also known as a spid)
• Context ID (a unique ID for each subthread in a particular process)
• Username
• Database
• Current status
• Number of open transactions
• Most recent command
• Application that owns the process
• Most recent time spent waiting
• Current wait type
• What resources the process is waiting for
Trang 19• Time last batch was submitted
• Host name
• Network library in use
• Network address
• Any processes that are blocked by this process
• Any processes that are blocking this processDouble-clicking a process lets you see the most recent SQL batch submitted by thatprocess You can also send a message to the owner of the process using Net Send fromthis property dialog box
The Locks/Process ID node contains one node for each process running on theserver Clicking one of these nodes will cause SQL Server Enterprise Manager to showinformation on all of the locks being maintained by the process You can double-click
an individual lock to see the detailed properties for that lock
The Locks/Object node contains one node for each database that’s in use Clickingone of these nodes will show all of the locks that apply to objects in that database.You can double-click an individual lock to see the detailed properties for that lock
NOTE You’ll learn more about locking in Chapter 25
Database Maintenance Plans
When you click a Database Maintenance Plans node, SQL Server Enterprise Managershows you all of the database maintenance plans that are stored on the current server
A database maintenance plan contains a schedule for operations such as checkingdatabase integrity, shrinking bloated files, and backing up databases
From a Database Maintenance Plans node, you can create and delete databasemaintenance plans You can also view the history of the plans, which tells you whenthey were most recently executed and provides details on the activities that they car-ried out
The shortcut menu for an individual database maintenance plan lets you view thehistory of that plan or delete that plan Double-clicking a database maintenance planopens the property sheet for that plan
NOTE Chapter 16 contains more information about database maintenance
Trang 20SQL Server Logs
The SQL Server Logs node for a server holds nodes for the current activity log and forthe six most recent activity logs before that Whenever you start SQL Server, it startswriting events to the Windows NT application event log These events are also avail-able in the SQL Server log
When you select one of the individual log nodes, SQL Server Enterprise Managershows the individual log entries in the right-hand pane, as shown in Figure 9.24 Foreach entry, SQL Server Enterprise Manager displays the date, the source of the entry,and the message it contains You can double-click an entry to view an entire message
if it’s truncated in the default display
Trang 21The Replication Folders
The nodes in the Replication folders depend on the server’s role in replication If theserver is a replication subscriber only, there will be nodes for publications and sub-scriptions If the server is a replication distributor or replication publisher, there will
be an additional folder for Replication Monitor This folder contains information oncurrent replication activities Figure 9.25 shows this portion of the SQL Server Enter-prise Manager treeview
FIGURE 9.25
Replication and Replication Monitor folder contents
TIP Any replication components with errors will be shown with red X marks over theiricons in the treeview
coun-• View distributor properties
• Change the refresh rate for information displayed in SQL Server EnterpriseManager
Trang 22NOTE You’ll learn about replication in Chapter 27.
• View agent history
• View agent properties
• View agent profiles
• Start or stop agents
• Start or stop synchronizationDouble-clicking a publication will show you the history for that publication Double-clicking a subscription will show you the most recent errors for that subscription
Agents
An Agents folder contains subfolders for each type of agent involved in the tion process:
replica-• Snapshot agents are responsible for taking initial snapshots of data
• Log reader agents are responsible for reading transaction log entries
• Queue reader agents are responsible for queuing updates that cannot be diately made due to communications problems
imme-• Distribution agents are responsible for sending data to other servers
• Merge agents are responsible for merging data from two servers
• Miscellaneous agents handle cleanup and other maintenance tasks
When you click one of the agent subfolders, SQL Server Enterprise Manager plays all of the agents in that folder You can view the agent history or agent proper-ties from the shortcut menu for an individual agent
Trang 23NOTE SQL Server Enterprise Manager displays a red X on the icon of any agent that’shaving problems.
Replication Alerts
When you click a Replication Alerts folder, SQL Server Enterprise Manager displays all
of the replication alerts that are defined for the current server Replication alerts, like
regular alerts, are conditions that SQL Server can monitor together with responses tothese conditions The only difference between replication alerts and regular alerts isthat replication alerts are specifically concerned with replication tasks
The Security Folder
Each server in the SQL Server Enterprise Manager tree contains a Security folder TheSecurity folder is just a place to bring together four types of security-related information:
Logins provide the security context for the users on SQL Server When you click a Logins
node, SQL Server Enterprise Manager displays information on all of the logins known tothe current server For each login, you’ll see:
• The login name
• The type of login (standard login, NT user, or NT group)
• Whether the login is permitted or denied access to the server
• The default database for the login
• The default language for the login
Trang 24From the Logins node, you can create and delete logins Double-clicking an vidual login allows you to view the properties for that login, including its securityproperties, the databases it has access to, and the server roles in which it participates.
indi-Server Roles
Server roles are built-in sets of permissions that SQL Server supplies For example,
there’s a Server Administrator role that allows its members to configure serverwidesettings When you click a Server Roles node, SQL Server Enterprise Manager displaysall of the server roles on that server
Double-clicking a server role opens the property sheet for that role The first tab ofthis property sheet lets you specify which logins participate in this server role Thesecond tab shows you the operations that this server role has permission to perform
NOTE Unlike with most other objects displayed in SQL Server Enterprise Manager, youcan’t create or delete server roles
Linked Servers
Linked servers are servers that SQL Server Enterprise Manager knows about, but that
are not necessarily Microsoft SQL Servers A linked server might be an Oracle database
or a Microsoft Access database, for example You can link to any database that can beaccessed via an OLE DB provider
The Linked Servers node in SQL Server Enterprise Manager contains one node foreach server linked to the current server Each server node in turn contains a Tablesnode When you click a Tables node, SQL Server Enterprise Manager displays all of thetables on that linked server
You can add and delete linked servers from a Linked Servers node Double-clicking
a linked server will show the connection details for that server in its property sheet
Figure 9.26 shows a linked server property sheet
Trang 25FIGURE 9.26
Connection information for a linked server
N OTE Linked servers are primarily used in T-SQL statements You can’t manage alinked server with SQL Server Enterprise Manager
Remote Servers
Remote servers are Microsoft SQL Servers that allow users from the current server to
execute stored procedures When you click a Remote Servers node, SQL Server prise Manager will display information on all of the current server’s remote servers.Double-clicking a remote server brings up the remote server property sheet shown
Enter-in Figure 9.27 Here you can map logEnter-ins, specifyEnter-ing the remote logEnter-in name thatshould be used to execute stored procedures when invoked by a login from the cur-rent server