Displaying Table Sizes using T-SQL

May 27th, 2011 No comments

Calculating resource usage and capacity planning for SQL server databases can be a time consuming business and there are many factors to take into consideration. Over time we plan to provide some tips and resources that we’ve come across over the years to help out in this area.

We’re often asked by clients who are using our shared database servers to provide them with information related to the performance of their database. We provide a number of statistics by default but a fairly common request is for a breakdown on the storage usage of their database. The script below is an example of how you can use T-SQL to query the database itself to provide a breakdown on the space used for each table in the database. It also provides the total allocated space to each table and an approximate row count.

T-SQL script to display table size summary:

SELECT LEFT(OBJECT_NAME(id), 30) AS [Table],
CAST( CAST(reserved * 8192 AS DECIMAL(10,1)) / 1000000.0 AS DECIMAL(10,1)) AS ‘Allocated (MB)’,
CAST(CAST(dpages * 8192 AS DECIMAL(10,1)) / 1000000.0 AS DECIMAL(10,1)) AS ‘Used (MB)’,
CAST(CAST((reserved – dpages) * 8192 AS DECIMAL(10,1)) / 1000000.0 AS DECIMAL(10,1)) AS ‘Unused (MB)’,
rowcnt AS ‘Row Count (approx.)’
FROM sysindexes WHERE indid IN (0, 1) AND OBJECT_NAME(id) NOT LIKE ‘sys%’ AND OBJECT_NAME(id) NOT LIKE dt%’

ORDER BY reserved DESC, LEFT(OBJECT_NAME(id), 30)

The script above, along with others that we will post in the future, can be really useful in helping to gain a clearer picture about how your database is being used and can provide pointers to what you might want to look at when attempting to optimise performance.

 

Categories: Databases Tags: ,

Flexible File Copying with Robocopy

March 25th, 2011 No comments

One of the handiest command line tools that we’ve come across in recent years is robocopy which has been built into the operating system since the advent of Vista. It is a flexible file copying command which unlike other commands such as copy or xcopy can be used for both simple file copy actions to reliable mirroring of whole folders of any size. It can copy files, move files, copy only changed files, copy security attributes, NTFS permissions and owner information of files to name but a few of the options. It is pretty much the Windows equivalent of the well known rsync utility on Linux.

At Secura Hosting, we provide all managed dedicated server clients with an allocation of storage on our NAS storage network which is located across remote data centres. Many of our clients use the robocopy to schedule copies of their important data to this remote storage. One of the features that makes this tool great for backing up over the network is that you can specify retry attempts and retry interval periods for any interruptions in the copying process.

The following are some examples of how you can use robocopy:


Robocopy Example 1: Copy folder (including subfolders) from one server to another

robocopy \\server1\folder1 \\server2\folder1-backup /E


Robocopy Example 2: Mirror a complete folder (including subfolders) from one server to another, removing folders on the destination that no longer exist on the source

robocopy \\server1\folder1 \\server2\folder1-mirror /MIR


Robocopy Example 3: Move files over 7 days old to another server (locked files will be retried every 30 seconds a maximum of 3 times)

robocopy \\server1\folder1 \\server2\folder1-archive /move /minage:14 /r:3 /w:30


You can find the full command line reference by simply typing ‘robocopy /?’ (without the quotes) at a command prompt or by visiting here http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx

 

Categories: Utilities Tags:

Featured Web App – WordPress

March 16th, 2011 1 comment

Microsoft Web Apps - WordPress

Everyone is talking about WordPress and there is good reason. It has become one of the most widely used blogging tools on the internet today. Many designers are extending its functionality to create beautiful websites with ease. If, as a designer or developer, you want to experience the full power of this platform you’ll need to be working with the self hosted platform i.e. you need to find a hosting company that can offer this to you (we can certainly recommend one!).


Already have a dedicated server running Windows? Perfect, the install is simple. All you need to do is download and install the Microsoft Web Platform Installer (http://www.microsoft.com/web/downloads/platform.aspx). Its a very straightforward install. If you have already installed the product then you can add any Web Apps including WordPress to a new website within IIS. The image below shows where the application is found.

 

 

The install process of WordPress takes you through installing MySQL and PHP on your server both of which perform fantastically on Windows these days. There really is very little to do apart from choosing administrative passwords for the applications (please make sure these are very strong!).

Once up and running you are free to install any of the widely available templates and any updates to the software are simple. We do recommend that you check for WordPress updates regularly as these often address security issues.

Of course for existing clients, we’ll support any issues with IIS so please contact us if you have any queries or need some guidance!


Categories: Web Applications Tags: , ,

IIS 7.0 HTTP Status Codes and their Causes

March 11th, 2011 No comments

1xx – Informational

These HTTP status codes indicate a provisional response. The client computer receives one or more 1xx responses before the client computer receives a regular response.

IIS 7.0 uses the following informational HTTP status codes:

  • 100 – Continue.
  • 101 – Switching protocols.

2xx – Success

These HTTP status codes indicate that the server successfully accepted the request.

IIS 7.0 uses the following success HTTP status codes:

  • 200 – OK. The client request has succeeded.
  • 201 – Created.
  • 202 – Accepted.
  • 203 – Nonauthoritative information.
  • 204 – No content.
  • 205 – Reset content.
  • 206 – Partial content.

3xx – Redirection

These HTTP status codes indicate that the client browser must take more action to fulfill the request. For example, the client browser may have to request a different page on the server. Or, the client browser may have to repeat the request by using a proxy server.

IIS 7.0 uses the following redirection HTTP status codes:

  • 301 – Moved permanently.
  • 302 – Object moved.
  • 304 – Not modified.
  • 307 – Temporary redirect.

4xx – Client error

These HTTP status codes indicate that an error occurred and that the client browser appears to be at fault. For example, the client browser may have requested a page that does not exist. Or, the client browser may not have provided valid authentication information.

IIS 7.0 uses the following client error HTTP status codes:

  • 400 – Bad request. The request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 400 error:
    • 400.1 – Invalid Destination Header.
    • 400.2 – Invalid Depth Header.
    • 400.3 – Invalid If Header.
    • 400.4 – Invalid Overwrite Header.
    • 400.5 – Invalid Translate Header.
    • 400.6 – Invalid Request Body.
    • 400.7 – Invalid Content Length.
    • 400.8 – Invalid Timeout.
    • 400.9 – Invalid Lock Token.
  • 401 – Access denied.IIS 7.0 defines several HTTP status codes that indicate a more specific cause of a 401 error. The following specific HTTP status codes are displayed in the client browser but are not displayed in the IIS log:
    • 401.1 – Logon failed.
    • 401.2 – Logon failed due to server configuration.
    • 401.3 – Unauthorized due to ACL on resource.
    • 401.4 – Authorization failed by filter.
    • 401.5 – Authorization failed by ISAPI/CGI application.
  • 403 – Forbidden.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 403 error:
    • 403.1 – Execute access forbidden.
    • 403.2 – Read access forbidden.
    • 403.3 – Write access forbidden.
    • 403.4 – SSL required.
    • 403.5 – SSL 128 required.
    • 403.6 – IP address rejected.
    • 403.7 – Client certificate required.
    • 403.8 – Site access denied.
    • 403.9 – Forbidden: Too many clients are trying to connect to the Web server.
    • 403.10 – Forbidden: Web server is configured to deny Execute access.
    • 403.11 – Forbidden: Password has been changed.
    • 403.12 – Mapper denied access.
    • 403.13 – Client certificate revoked.
    • 403.14 – Directory listing denied.
    • 403.15 – Forbidden: Client access licenses have exceeded limits on the Web server.
    • 403.16 – Client certificate is untrusted or invalid.
    • 403.17 – Client certificate has expired or is not yet valid.
    • 403.18 – Cannot execute requested URL in the current application pool.
    • 403.19 – Cannot execute CGI applications for the client in this application pool.
    • 403.20 – Forbidden: Passport logon failed.
    • 403.21 – Forbidden: Source access denied.
    • 403.22 – Forbidden: Infinite depth is denied.
  • 404 – Not found.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 404 error:
    • 404.0 – Not found.
    • 404.1 – Site Not Found.
    • 404.2 – ISAPI or CGI restriction.
    • 404.3 – MIME type restriction.
    • 404.4 – No handler configured.
    • 404.5 – Denied by request filtering configuration.
    • 404.6 – Verb denied.
    • 404.7 – File extension denied.
    • 404.8 – Hidden namespace.
    • 404.9 – File attribute hidden.
    • 404.10 – Request header too long.
    • 404.11 – Request contains double escape sequence.
    • 404.12 – Request contains high-bit characters.
    • 404.13 – Content length too large.
    • 404.14 – Request URL too long.
    • 404.15 – Query string too long.
    • 404.16 – DAV request sent to the static file handler.
    • 404.17 – Dynamic content mapped to the static file handler via a wildcard MIME mapping.
    • 404.18 – Querystring sequence denied.
    • 404.19 – Denied by filtering rule.
  • 405 – Method Not Allowed.
  • 406 – Client browser does not accept the MIME type of the requested page.
  • 408 – Request timed out.
  • 412 – Precondition failed.

5xx – Server error

These HTTP status codes indicate that the server cannot complete the request because the server encounters an error.

IIS 7.0 uses the following server error HTTP status codes:

  • 500 – Internal server error.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 500 error:
    • 500.0 – Module or ISAPI error occurred.
    • 500.11 – Application is shutting down on the Web server.
    • 500.12 – Application is busy restarting on the Web server.
    • 500.13 – Web server is too busy.
    • 500.15 – Direct requests for Global.asax are not allowed.
    • 500.19 – Configuration data is invalid.
    • 500.21 – Module not recognized.
    • 500.22 – An ASP.NET httpModules configuration does not apply in Managed Pipeline mode.
    • 500.23 – An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode.
    • 500.24 – An ASP.NET impersonation configuration does not apply in Managed Pipeline mode.
    • 500.50 – A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error occurred.
      Note Here is where the distributed rules configuration is read for both inbound and outbound rules.
    • 500.51 – A rewrite error occurred during GL_PRE_BEGIN_REQUEST notification handling. A global configuration or global rule execution error occurred.
      Note Here is where the global rules configuration is read.
    • 500.52 – A rewrite error occurred during RQ_SEND_RESPONSE notification handling. An outbound rule execution occurred.
    • 500.53 – A rewrite error occurred during RQ_RELEASE_REQUEST_STATE notification handling. An outbound rule execution error occurred. The rule is configured to be executed before the output user cache gets updated.
    • 500.100 – Internal ASP error.
  • 501 – Header values specify a configuration that is not implemented.
  • 502 – Web server received an invalid response while acting as a gateway or proxy.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 502 error:
    • 502.1 – CGI application timeout.
    • 502.2 – Bad gateway.
  • 503 – Service unavailable.IIS 7.0 defines the following HTTP status codes that indicate a more specific cause of a 503 error:
    • 503.0 – Application pool unavailable.
    • 503.2 – Concurrent request limit exceeded.

Categories: IIS Tags:

What is an Application Pool?

March 11th, 2011 No comments

An Application Pool can contain one or more applications and allows us to configure a level of isolation between different Web applications. For example, if you want to isolate all the Web applications running in the same computer, you can do this by creating a separate application pool for every Web application and placing them in their corresponding application pool. Because each application pool runs in its own worker process, errors in one application pool will not affect the applications running in other application pools. Deploying applications in application pools is a primary advantage of running IIS 6.0 in worker process isolation mode because you can customize the application pools to achieve the degree of application isolation that you need.

Categories: IIS Tags:

Contact Secura Hosting

March 4th, 2011 No comments

Should you need to call us or email a particular department, please use the contacts listed below:

Website
http://www.securahosting.com

Article Requests, Blog Comments
Email: blog@securahosting.com

New Sales
Email: sales@securahosting.com
Phone: 0207 183 2540

Accounts and Billing
Email: accounts@securahosting.com
Phone: 0207 183 2540Hours: 9am to 5:30pm (UK), Monday to Friday

Technical Support
Email: support@securahosting.com
Phone: Your Account Manager will provide a contact number for 24 hour emergency telephone support.

Surface Mail

Secura Hosting Ltd
Secura House
3 The Mill Race
Lemsford
Herts
AL8 7TW
UK

Categories: Contact Secura Hosting Tags:

FTP Status Codes and their Causes

March 4th, 2011 No comments

1xx – Positive Preliminary Reply

These status codes indicate that an action has started successfully, but the client expects another reply before it continues with a new command.

  • 110 Restart marker reply.
  • 120 Service ready in nnn minutes.
  • 125 Data connection already open; transfer starting.
  • 150 File status okay; about to open data connection.

2xx – Positive Completion Reply

An action has successfully completed. The client can execute a new command.

  • 200 Command okay.
  • 202 Command not implemented, superfluous at this site.
  • 211 System status, or system help reply.
  • 212 Directory status.
  • 213 File status.
  • 214 Help message.
  • 215 NAME system type, where NAME is an official system name from the list in the Assigned Numbers document.
  • 220 Service ready for new user.
  • 221 Service closing control connection. Logged out if appropriate.
  • 225 Data connection open; no transfer in progress.
  • 226 Closing data connection. Requested file action successful (for example, file transfer or file abort).
  • 227 Entering passive mode (h1,h2,h3,h4,p1,p2).
  • 230 User logged in, proceed.
  • 250 Requested file action okay, completed.
  • 257 “PATHNAME” created.

3xx – Positive Intermediate Reply

The command was successful, but the server needs additional information from the client to complete processing the request.

  • 331 User name okay, need password.
  • 332 Need account for login.
  • 350 Requested file action pending further information.

4xx – Transient Negative Completion Reply

The command was not successful, but the error is temporary. If the client retries the command, it may succeed.

  • 421 Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down.
  • 425 Cannot open data connection.
  • 426 Connection closed; transfer aborted.
  • 450 Requested file action not taken. File unavailable (for example, file busy).
  • 451 Requested action aborted: Local error in processing.
  • 452 Requested action not taken. Insufficient storage space in system.

5xx – Permanent Negative Completion Reply

The command was not successful, and the error is permanent. If the client retries the command, it receives the same error.

  • 500 Syntax error, command unrecognized. This may include errors such as command line too long.
  • 501 Syntax error in parameters or arguments.
  • 502 Command not implemented.
  • 503 Bad sequence of commands.
  • 504 Command not implemented for that parameter.
  • 530 Not logged in.
  • 532 Need account for storing files.
  • 550 Requested action not taken. File unavailable (for example, file not found, no access).
  • 551 Requested action aborted: Page type unknown.
  • 552 Requested file action aborted. Exceeded storage allocation (for current directory or dataset).
  • 553 Requested action not taken. File name not allowed.

Common FTP Status Codes and Their Causes

  • 150 – FTP uses two ports: 21 for sending commands, and 20 for sending data. A status code of 150 indicates that the server is about to open a new connection on port 20 to send some data.
  • 226 – The command opens a data connection on port 20 to perform an action, such as transferring a file. This action successfully completes, and the data connection is closed.
  • 230 – This status code appears after the client sends the correct password. It indicates that the user has successfully logged on.
  • 331 – You see this status code after the client sends a user name. This same status code appears regardless of whether the user name that is provided is a valid account on the system.
  • 426 – The command opens a data connection to perform an action, but that action is canceled, and the data connection is closed.
  • 530 – This status code indicates that the user cannot log on because the user name and password combination is not valid. If you use a user account to log on, you may have mistyped the user name or password, or you may have chosen to allow only Anonymous access. If you log on with the Anonymous account, you may have configured IIS to deny Anonymous access.
  • 550 – The command is not executed because the specified file is not available. For example, this status code occurs when you try to GET a file that does not exist, or when you try to PUT a file in a directory for which you do not have Write access.

 

Categories: FTP Tags:

About this Blog

March 4th, 2011 No comments

This blog will be a resource for technical articles written by Secura Hosting which are related to the services provided to our clients.

Over the coming months we will be producing a number of posts which are related to the more common support issues that we deal with on a day to day basis.

We will be using the blog to announce and discuss any new services that we may offer and welcome any comments on these.

There may also be the odd comment and opinion on industry matters should we feel the need to air these!

Categories: About this Blog Tags:

What is POP3?

March 4th, 2011 No comments

POP3 (Post Office Protocol 3) is the most recent version of a standard protocol for receiving e-mail. POP3 is a client/server protocol in which e-mail is received and held for you by your Internet server. Periodically, you (or your client e-mail receiver) check your mail-box on the server and download any mail, probably using POP3. This standard protocol is built into most popular e-mail products, such as Eudora and Outlook Express. It’s also built into the Netscape and Microsoft Internet Explorer browsers.

POP3 is designed to delete mail on the server as soon as the user has downloaded it. However, some implementations allow users or an administrator to specify that mail be saved for some period of time. POP can be thought of as a “store-and-forward” service.

An alternative protocol is Internet Message Access Protocol (IMAP). IMAP provides the user more capabilities for retaining e-mail on the server and for organizing it in folders on the server. IMAP can be thought of as a remote file server.

POP and IMAP deal with the receiving of e-mail and are not to be confused with the Simple Mail Transfer Protocol (SMTP), a protocol for transferring e-mail across the Internet. You send e-mail with SMTP and a mail handler receives it on your recipient’s behalf. Then the mail is read using POP or IMAP.

 

Categories: Email Tags: ,

SMTP Error Messages

March 4th, 2011 No comments

A mail server will reply to every request a client (such as your email program) makes with a return code. This code consists of three numbers.

The first generally tells whether the server accepted the command and if it could handle it. The five possible values are:

  • 1: The server has accepted the command, but does not yet take action. A confirmation message is required. Currently, this is not used.
  • 2: The server has completed the task successfully.
  • 3: The server has understood the request, but requires further information to complete it.
  • 4: The server has encountered a temporary failure. If the command is repeated without any change, it might be completed. Mail servers can use such temporary failures to keep untrusted senders at bay.
  • 5: The server has encountered an error.

The second number gives more information. Its six possible values are:

  • 0: A syntax error has occurred.
  • 1: Indicates a informational reply, for example to a HELP request.
  • 2: Refers to the connection status.
  • 3 and 4 are unspecified.
  • 5: Refers to the status of the mail system as a whole and the mail server in particular.

The last number is even more specific and shows more graduations of the mail transfer status. This leads us to the detailed list of ESMTP server response codes, as laid down in RFC 821 and later extensions.

  • 211 – A system status message.
  • 214 – A help message for a human reader follows.
  • 220 – SMTP Service ready.
  • 221 – Service closing.
  • 250 – Requested action taken and completed. The best message of them all.
  • 251 – The recipient is not local to the server, but the server will accept and forward the message.
  • 252 – The recipient cannot be VRFYed, but the server accepts the message and attempts delivery.
  • 354 – Start message input and end with <CRLF>.<CRLF>. This indicates that the server is ready to accept the message itself (after you have told it who it is from and where you want to to go).
  • 421 – The service is not available and the connection will be closed.
  • 450 – The requested command failed because the user’s mailbox was unavailable (for example because it was locked). Try again later.
  • 451 – The command has been aborted due to a server error. Not your fault. Maybe let the admin know.
  • 452 – The command has been aborted because the server has insufficient system storage.

The following error messages (500-504) usually tell you that your email client is broken. It’s probably best to let the program’s author know.

  • 500 – The server could not recognize the command due to a syntax error.
  • 501 – A syntax error was encountered in command arguments.
  • 502 – This command is not implemented.
  • 503 – The server has encountered a bad sequence of commands.
  • 504 – A command parameter is not implemented.
  • 550 – The requested command failed because the user’s mailbox was unavailable (for example because it was not found, or because the command was rejected for policy reasons).
  • 551 – The recipient is not local to the server. The server then gives a forward address to try.
  • 552 – The action was aborted due to exceeded storage allocation.
  • 553 – The command was aborted because the mailbox name is invalid.
  • 554 – The transaction failed. Blame it on the weather

 

Categories: Email Tags: ,