Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

SQL Server 2012 Hosting - How To Create Contained Databases in SQL Server 2012

clock April 29, 2013 08:52 by author andy_yo

Contained databases are a new feature in SQL Server 2012 and are defined on MSDN Library as ”a database that is isolated from other databases and from the instance of SQL Server that hosts the database”.

About ASPHostPortal.com
ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, ASP.NET 4.5, ASP.NET MVC 4.0, Silverlight 5 and Visual Studio Lightswitch. Click here for more information

The containment setting of a database can be NONE, PARTIAL or FULL. But only NONE and PARTIAL are supported on SQL Server 2012.

Benefits and characteristics.
The following are some of the benefits and characteristics that contained databases have:

  • They make easier to migrate databases from one server to another. Errors related to orphan users are no longer an issue with contained databases, since a contained database user can now be created without an associated login.
  • Authentication can now occur at the database level.
  • Contained database users can be Windows and SQL Server authentication users.
  • A contained database user can access only contained database objects. They cannot access system databases and cannot access server objects.
  • Metadata is stored on the contained database and not stored on system databases. This makes contained databases more portable than the databases we know. 

Disadvantages and limitations.
Some disadvantages and limitations are the following:

  • There are some security concerns. A database owner can create contained database users without the permission of a DBA. The possibility of denial of service attacks exist with contained databases using AUTO_CLOSE option. For security best practices about contained databases, please see the references shown at the end of the article.
  • Partially contained databases cannot use replication, change data capture, change tracking, numbered procedures, schema-bound objects that depend on built-in functions with collation changes. You may find more limitations on the references shown at the end of this article.

Requirements of contained databases.

  • It is required to enable contained databases on the instance.
  • The contained database needs to be added to the connection string or specified when connecting via SQL Server Management Studio.

Step-by-step instructions on how to create a contained database.
To be able to create contained databases on a SQL Server 2012 instance, we need to enable the contained database authentication option on the instance.
Open SQL Server 2012 Management Studio, connect to the instance, make a right click on the name of the instance on Object Explorer, select the Advanced page on the "Select a page" panel, and set to true the "Enable Contained Databases" option.


Alternatively, you can use sp_configure system stored procedure to enable contained databases on the instance, as shown below

EXEC sp_configure 'show advanced', 1
GO
RECONFIGURE
GO

EXEC sp_configure 'contained database authentication', 1
GO
RECONFIGURE
GO

When a database is created the "Containment type" should be set to "partial" to make the database a contained database, as shown below.

This can be done using T-SQL too, as shown below.

A contained database allows the creation of a database user that is not associated to an instance login. A contained database user can be created expanding the Security folder on the contained database, making a right click on the Users folder and selecting the "New User" option.

Next, set the user type to "SQL user with password", assign a user name, set the password for the database user and specify the default schema for the user.

Specify the roles for this user on the database and click OK.

If you would like to create the contained database user using T-SQL, please see the example below.
CREATE USER [MorilloCD2User]
    WITH PASSWORD=[email protected]',
   
DEFAULT_SCHEMA=[dbo]
GO

To connect a contained database user to a contained database, the database name should be specified on the connection string. If you are using SQL Server Management Studio, on the Connect to Server dialog specify the authentication, specify the user name, provide the password, click on the Options button and specify the database name on the "Connect to database" combo box.



SQL 2012 Hosting - ASPHostPortal :: How to Manage SQL 2012 with Powershell

clock September 11, 2012 09:20 by author Jervis

     The graphical management tools provide just in this area everything you need to work with SQL Server. Still, there are many times when you might want to work from the command line, such as when you are working on a Windows Server 2008 R2 Core installation. To help with all your command-line needs, SQL Server 2012 includes the SQL Server provider for Windows PowerShell (also known as “SQL Server PowerShell”). To work with SQL Server via Windows PowerShell, you must first open a Command Prompt window or Windows PowerShell prompt and then initiation SQL Server PowerShell by typing sqlps at the command line.

Windows PowerShell introduces the concept of a cmdlet (pronounced “commandlet”). A cmdlet is the smallest unit of functionality in Windows PowerShell. Cmdlet names are not case-sensitive. SQL Server PowerShell cmdlets include the following:


-
Backup-SQLDatabase Performs backup operations on SQL Server databases.

-
Convert-UrnToPath Converts a SQL Server Management Object Uniform Resource Name (URN) to a SQL Server provider path. The URN indicates
a management object’s place within the SQL Server object hierarchy. If the URN path has characters not supported by Windows PowerShell, the characters are encoded automatically.

-
Decode-SQLName Returns an unencoded SQL Server identifier when given an identifier that has been encoded.

-
Encode-SQLName Encodes special characters in SQL Server identifiers and name paths to formats that are usable in Windows PowerShell paths. The characters encoded by this cmdlet include :/%<>*?[]|. If you don’t encode these characters, you must getting away from them by using the single quotation mark (‘) character.

-
Invoke-PolicyEvaluation Evaluates management policies applied to SQL Server instances. By default, this cmdlet intelligence compliance but does not enforce compliance. To enforce compliance, set –AdHocPolicyEvaluationMode to Configure.

-
Invoke-Sqlcmd Runs a Transact-SQL (T-SQL) or XQuery script containing orders supported by the SQLCMD utility. By default, this cmdlet doesn’t set any SQLCMD variables or return message output; only a subset of SQLCMD orders can be used.

-
Restore-SQLDatabase Performs restore operations on SQL Server databases.

To get detailed information in this area a cmdlet, type get-help cmdletname –detailed, where cmdletname is the name of the cmdlet you want to examine. To get detailed information in this area the SQL Server provider, which provides SQL Server functionality for Windows PowerShell, type
get-help sqlserver | more.

You can use the sqlps utility on any computer where you’ve installed SQL Server or the command-line management tools. The sqlps utility starts a Windows PowerShell session with the SQL Server PowerShell provider imported so that you can use its cmdlets and work with instances of SQL Server. When you are working with Windows PowerShell or scripts, you can import the SQLPS module to load the SQL Server provider, which automatically loads the vital assemblies and initializes the environment. While you previously needed to use an initialization script, this is no longer vital so long as you import the SQLPS module prior to trying to access the SQL Server instance. For best results, import the SQLPS module using the following command:


   Import-Module "sqlps" –DisableNameChecking

You can work with cmdlets by executing orders directly at the shell prompt or by running orders from scripts. You can enter any command or cmdlet that you can run at the Windows PowerShell command prompt into a script by copying the related command text to a file and reduction the file with the .ps1 extension. You can then run the script in the same way that you would any other command or cmdlet. Even if, when you are working with Windows PowerShell, the current index might not be part of the environment path. For this reason, you might need to use the ./ notation when you run a script in the current index, such as the following:

./runtasks


The current execution policy for SQL Server PowerShell controls whether and how you can run scripts. Although the default configuration depends on which operating system and journal you’ve installed, you can quickly determine the execution policy by inflowing get-executionpolicy at the Windows PowerShell prompt.


To set the execution policy to require that all scripts have a trusted signature to do, enter the following command:


set-executionpolicy allsigned

To set the execution policy so that scripts downloaded from the web do only if they are signed by a trusted source, enter:


set-executionpolicy remotesigned

To set the execution policy to run scripts regardless of whether they have a digital signature and work in an unrestricted environment, you can enter the following command:


set-executionpolicy unrestricted

For administration at the Windows PowerShell prompt, you use Invoke-Sqlcmd to run T-SQL or XQuery scripts containing orders supported by the SQLCMD utility. Invoke-Sqlcmd fully supports T-SQL and the XQuery syntax supported by the Database Engine, but it does not set any scripting variables by default. Invoke-Sqlcmd also accepts the SQLCMD orders listed in Table 1-3, later in this chapter. By default, results are formatted as a table, with the first result set showed automatically and subsequent result sets showed only if they have the same column list as the first result set.


The basic syntax you use most often with Invoke-Sqlcmd follows:


Invoke-Sqlcmd [-ServerInstance ServerStringOrObject]

[-Database DatabaseName] [-EncryptConnection ]
[-Username UserName] [-Password Password] [[-Query] QueryString] [-DedicatedAdministratorConnection]

[-InputFile FilePath] [ | Out-File –filepath FilePath]


The command’s parameters are used as follows:


–Database Specifies the name of the database that you want to work with. If you don’t use this parameter, the database that is used depends

on whether the current path specifies both the SQLSERVER:SQL folder
and a database name. If both are specified, Invoke-Sqlcmd connects to the database that is specified in the path. Otherwise, Invoke-Sqlcmd connects to the default database for the current login ID.

NOTE
Use–IgnoreProviderContext to force a connection to the database that is defined as the default for the current login ID.

–DedicatedAdministratorConnection Ensures that a dedicated administrator connection (DAC) is used to force a connection when one might not be possible otherwise.

–EncryptConnection Enables Secure Sockets Layer (SSL) encryption for the connection.


–InputFile Provides the full path to a file that must be used as the query participation. The file can contain T-SQL statements, XQuery statements, SQLCMD orders, and scripting variables. Spaces are not allowable in the file path or file name.


–Password Sets the password for the SQL Server Certification login ID that is specified in –Username.


–Query Defines one or more queries to be run. The queries can be T-SQL queries, XQuery statements, or SQLCMD orders. Separate multiple queries with semicolons.


TIP You do not need to use the SQLCMD GO command. Getting away from any dual quotation marks included in the string and consider using bracketed identifiers such as [EmpTable] instead of quoted identifiers such as “EmpTable”. To ensure that the message output is returned, add the –Verbose parameter. –Verbose is a parameter common to all cmdlets.


–ServerInstance Specifies the name of an instance of the Database Engine that you want to work with. For default instances, specify only the computer name, such as DbServer23. For named instances, use the format “ComputerNameInstanceName”, such as DbServer23EmployeeDb.


–Username Sets the login ID for making a SQL Server certification connection to an instance of the Database Engine. You also must set the password for the login ID.


NOTE By default, Invoke-Sqlcmd attempts a Windows certification connection

by using the Windows tab running the Windows PowerShell session. Windows certification connections are preferred. To use a SQL Server certification connection instead, specify the user name and password for the SQL login ID that you want to use.

With this in mind, you could replace the following T-SQL statements:


USE OrderSystem;
GO
SELECT * FROM Inventory.Product
ORDER BY Name ASC
GO


with the following Windows PowerShell command:


Invoke-Sqlcmd -Query "SELECT * FROM Inventory.Product; ORDER BY Name ASC"
-ServerInstance "DbServer23OrderSystem"


You also could read the orders from a script, as publicized in Try out 1-1. SAMPLE 1-1 Example SQL Command Script.


Contents of SqlCmd.sql Script.

 SELECT * FROM Inventory.Product
 ORDER BY Name ASC


Command to Run the Script

 Invoke-Sqlcmd -InputFile "C:ScriptsSqlCmd.sql"

22 PART I Microsoft SQL Server 2012 Essentials

When you work with Windows PowerShell, don’t overlook the importance of SQL Server help being implemented owing to a provider. The data that providers expose appears as a drive that you can browse. One way to browse is to get or set the place with respect to the SqlServer: provider drive. The top of the hierarchy exposed is represented by the SQL folder, then there is a folder for the machine name, and finally, there is a folder for the instance name. Following this, you could navigate to the top-level folder for the default instance by inflowing

Set-Place SQLSERVER:SQLDbServer23Default

You could then determine the available database structures by inflowing Get-ChildItem (or one of its aliases, such as ls or dir). To navigate logins, triggers, endpoints, databases, and any other structures, you set the place to the name of the related folder. For example, you could use Set-Place Databases and then enter Get-ChildItem to list available databases for the selected instance. Of course, if you know the full path you want to work with in the first place, you also can access it directly, as publicized in the following example:


Set-Place SQLSERVER:SQLDbServer23DefaultDatabasesOrderSystem

Here, you navigate to the structures for the OrderSystem database on DbServer23’s default instance. If you then want to determine what tables are available for this database, you could enter:


Get-ChildItem Tables

Or you could enter:


Set-place Tables
Get-ChildItem


To manage SQL Server 2012 from a computer that isn’t running SQL Server, you need to install the management tools. In the SQL Server Installation Center, select Installation, and then click the New Installation Or Add Features To An Existing Installation choice. When the wizard starts, follow the prompts. On the Feature Choice page, select the Management Tools—Basic choice to install Management Studio, SQLCMD, and the SQL Server provider for Windows PowerShell.


For diffident management via Windows PowerShell, you need to ensure that Windows Diffident Management (WinRM) and Windows PowerShell are both installed and made available by using the Add Features Wizard. You also need to make possible diffident orders on both your management computer and the server running SQL Server.

You can verify the availability of WinRM and configure Windows PowerShell for remoting by following these steps:

1. Click Initiation, All Programs, Accessories, and Windows PowerShell. Then initiation Windows PowerShell as an administrator by right-clicking the Windows PowerShell shortcut and selecting Run As Administrator.

2. The WinRM service is configured for manual startup by default. You
must change the startup type to Automatic and initiation the service on each computer you want to work with. At the PowerShell prompt, you can verify that the WinRM service is running by using the following command:

      get-service winrm


        0. f the service is stopped, enter the following command to initiation the service and configure it to initiation automatically in the future:

            set-service –name winrm –startuptype automatic –status running

        1. To configure Windows PowerShell for remoting, type the following command:

            Make possible-PSRemoting –force

You can make possible remoting only when your computer is connected to a domain or private network. If your computer is connected to a public network, you need to disconnect from the public network and connect to a domain or private network and then repeat this step. If one or more of your computer’s connections has the Public connection type but you are really connected to a domain or private network, you need to change the network connection type in the Network And Sharing Center and then repeat this step.

In many cases, you can work with diffident computers in other domains. Even if, if the diffident computer is not in a trusted domain, the diffident computer might not be able to authenticate your credentials. To make possible certification, you need to add the diffident computer to the list of trusted hosts for the local computer in WinRM. To do so, type the following:

winrm s winrm/config/client ‘@{TrustedHosts=”RemoteComputer”}’ where RemoteComputer is the name of the diffident computer, such as winrm s winrm/config/client ‘@{TrustedHosts=”DbServer23″}’


When you are working with computers in workgroups or homegroups, you must use HTTPS as the transport or add the diffident machine to the TrustedHosts configuration settings. If you cannot connect to a diffident host, you can verify that the service on the diffident host is running and is accepting requests by running the following command on the diffident host:


winrm quickconfig
Status   Name
------   ----
Running  WinRM
DisplayName
-----------
Windows Diffident Management


24 PART I Microsoft SQL Server 2012 Essentials


This command analyzes and configures the WinRM service. If the WinRM service is set up correctly, you see output similar to the following:


WinRM already is set up to receive requests on this machine.
WinRM already is set up for diffident management on this machine.

If the WinRM service is not set up correctly, you see errors and need to respond affirmatively to several prompts that allow you to configure diffident management automatically. When this process is complete, WinRM must be set up correctly. Don’t forget that you need to make possible diffident management on the database server as well as your management computer.


Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what
ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.

- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.

- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.

- Data Center

ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.

- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.

- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.

- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

 



ASPHostPortal Announces SQL Server 2012 Support

clock May 1, 2012 08:44 by author Jervis

ASPHostPortal is a premiere web hosting company that specialized in Windows and ASP.NET-based hosting, announces the deployment of SQL Server 2012 in its web hosting packages. The SQL Server 2012 is brand new database management software from Microsoft that provides robust solutions for businesses to organize and secure company's data in one large-scale framework.

One of the most powerful and recognized SQL database engines available, Microsoft SQL Server provides many different levels of functionality and feature sets, and the latest release includes greater uptime, enhanced query performance, and improved security features. Also included is the new ‘Business Intelligence’ version of the product, and a more scaled-down ‘Express’ version, featuring the new ‘LocalDB’ functionality.


"I am very proud today, as we again have been able to exceed expectations by being able to offer this latest version of SQL Server to our customers so quickly after its official release," said Robert Kruger, CEO of ASPHostPortal.com. "We continue to offer significant added value to Microsoft products. We prove our existence in this business."


ASPHostPortal offers hosting packages bundle with the SQL Server 2012, including ASP.NET hosting and also our Reseller Hosting. This is to ensure that its customers can always have the latest technology included in their account. Businesses with all of important data from each department need a framework to manage and secure all of that data. And it can be achieved by implementing the SQL Server 2012. This robust data warehouse development merges everything together and makes sure there is no leakage. SQL Server 2012 keeps every data on its place and works as its best.
 

For more information about this new product, please visit our site at
http://asphostportal.com/Cheap-SQL-2012-Hosting.aspx.

About ASPHostPortal:

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions


Author Link


Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in