During my career which is mainly done in a company which creates software for smart grid solution, and in a power distribution utility, most of the time I have been working with database aspects of that story. The purpose of this blog is to give an insight into general database aspects, with reference to smart grid specifics. Also, I am going to discuss other interesting Smart Grid subjects.
Tuesday, March 27, 2012
Thursday, March 22, 2012
How to start SQL server from command line, and what happens next
If You want to start SQL Server from command line, go to the desired SQL Server binn folder:
cd \Program Files\Microsoft SQL Server\MSSQL10_50.1\MSSQL\Binn
If there are more SQL Servers installations on a machine, there could a problem if You do not go to the desired location, because there would be more sqlserver.exe instances.
You could start one SQL Server instance from another SQL Server binn folder(with different SQL Server instance name), but that can cause unknown problems.
So, when I go to the desired binn folder, execute
sqlserver -s instancename
What's happening next?
In Windows registry, there is following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
and there is following variable:
InstalledInstances
with instance names which are installed on Your machine. One of these instances has the same name as You entered in previous command which starts SQL Server.
For every of these instances there is a adequate registry path.
For example, one of the instances can have a name SQLEXPRESS, there will be following registry path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS
where this last SQLEXPRESS is the name of the instance.
Under this registry key there is a key named MSSQLServer -> Parameters where are the parameters used in process of starting SQL Server instance.
By default there should be 3 parameters:
- d - which represents the path to the master database data file
- l - which represents the path to the master database log file
- e - which represents the path to the error log
Path to the master database is essential because it is the first database which is brought up online, and in this database are data needed for all other database which should be started.
cd \Program Files\Microsoft SQL Server\MSSQL10_50.1\MSSQL\Binn
If there are more SQL Servers installations on a machine, there could a problem if You do not go to the desired location, because there would be more sqlserver.exe instances.
You could start one SQL Server instance from another SQL Server binn folder(with different SQL Server instance name), but that can cause unknown problems.
So, when I go to the desired binn folder, execute
sqlserver -s instancename
What's happening next?
In Windows registry, there is following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
and there is following variable:
InstalledInstances
with instance names which are installed on Your machine. One of these instances has the same name as You entered in previous command which starts SQL Server
For every of these instances there is a adequate registry path.
For example, one of the instances can have a name SQLEXPRESS, there will be following registry path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS
where this last SQLEXPRESS is the name of the instance.
Under this registry key there is a key named MSSQLServer -> Parameters where are the parameters used in process of starting SQL Server instance.
By default there should be 3 parameters:
- d - which represents the path to the master database data file
- l - which represents the path to the master database log file
- e - which represents the path to the error log
Path to the master database is essential because it is the first database which is brought up online, and in this database are data needed for all other database which should be started.
SQL Server error log
To view the SQL Server error log
Start Microsoft SQL Server Management Studio, open Object Explorer, expand a server, expand Management, and then expand SQL Server Logs.
Right-click a log and click View SQL Server Log.
Or execute following statement:
SELECT SERVERPROPERTY('ErrorLogFileName')
You should get something like this:
G:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
Start Microsoft SQL Server Management Studio, open Object Explorer, expand a server, expand Management, and then expand SQL Server Logs.
Right-click a log and click View SQL Server Log.
Or execute following statement:
SELECT SERVERPROPERTY('ErrorLogFileName')
You should get something like this:
G:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
Subscribe to:
Posts (Atom)