Archive for the ‘Web Hosting and Database Tips’ Category


This tip is on web hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Getting Domains for Under $11 / Year

Part of your web hosting cost is domains and if you only have 1 it is not a big cost difference but if you need more than 1 domain such as for SEO reasons then here is a link for getting domains for $10.95/domain year:

Click on this link:  http://www.sozodomains.com/ for domain registrations starting at $10.95 per domain year for the most common domain extensions  (click on this link http://www.sozodomains.com/pricingfull.php for pricing of all domain extensions they sell).    You can sign up for an account on this SoZo Web domain system on this link: https://www.sozodomains.com/createacct.php

This SoZo Domain system notifies you via email, 60 days, 30 days and 7 days before your domain expiries.  You can easily renew the domain on a major credit card on your account or let it expire if you dont need it anymore.  You can also do domain transfers into your SoZo Domains account or domain transfers out of your account to other domain registrars.



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Database Logins and Security with MS SQL 2005 and 2008

You can set up a different login ids and passwords for each person that will be accessing a database on your system. Set the password with upper and lower characters and at least 1 number. Then in the customer database, add the login id with the same login id that that you added in the security section. Here is the steps the SQL Studio management tool (this tool you can download free from microsoft):

1) Add the new database

2) Click on the security folder at the bottom left of your menu, the folder that is NOT inside a database folder. Right click on the Security/Login folder and click on the NewLogin option. Add the new login id . After selecting the SQL Server Authentication radio box option and entering a unqiue password, usually you only need the enforce password policy check box checked. Point the default database to the new database you just added in step 1 and select the correct language. Click ok.

3) Open up the Security/Login folder INSIDE the new database you just added and right click on user folder and select the Add User menu option. Add the same user id in step 2. For the roles for a web access type client, normally you check all the check all the role check boxes EXCEPT these 3: db_backupoperator, and the 2 db_deny… check boxes. Click Ok and now you are done.

For more information click on this link:  http://www.sozohosting.com/knowledge/microsoft-sql-server-database-tips.cfm

 

PS.

Microsoft sql server 2005 management studio client tools (Express) can be downloaded for free from

http://www.microsoft.com/download/en/details.aspx?id=8961.

 

PSS.

Microsoft sql server 2008 management studio client tools (Express) can be downloaded for free from

http://www.microsoft.com/download/en/details.aspx?id=22985.

You should read the prequisites on this link:  http://msdn.microsoft.com/en-us/library/ms365247.aspx

 



This tip is on web hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Help On Email Alerts For Cacti

In order to set email alerts in Cacti you need to install the Cacti Plugin Architecture. This can be found at http://docs.cacti.net/manual:087:1_installation.9_pia#installing_plugins, this is a good document for instructions on how to install and add plugins. Once this is installed be sure to go under the Utilities section of Cacti and select User Management. Once in User Management you will need to select the users you would like to have the ability to set Thresholds. You would do this by selecting the user, go to the realm permissions tab, then put a check on the Thresholds you would like to allow the user to have access to. Next hit save and you are done.

Also I found a little gotcha on the installation that had me stuck for a few hours. When you are on the final stages of the installation of the plugin architecture make sure you have the settings plugin installed. This plugin should be set in the config.php as ($plugins[] = ’settings’; ) . Also you do not need to add other plugins to the config.php , just load them in the /cacti/plugins directory . Then once they are there go to the configuration section , plugin management and the plugin will appear.



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Database Back Ups With Maintenance Plans MS SQL 2005 and 2008

Using SQL Studio management tool you can set up a maintenance plan to back up all your databases nightly (or whatever schedule you want) onto another drive (preferable one on another server).

We recommend you select the option to do a FULL backup on ALL databases since you could add new databases later and this maintenance plan you set up will start backing up the new databases. Select the option to back up each database in a different folder. When you select the maintenance plan folder in the SQL Studio management tool, select the Maintenance Wizard to set up the automatic database back up plan and set a schedule on how often backups recur. The schedule will fire as long as you have SQL Server agent running. SQL Studio management tool will show you if SQL agent is running if you look on the menus on the lower left. If it is not running, then go to your control panel, then open up services for that server, and scroll down till you see SQL Server Agent. Right click on SQL Server Agent and set it to automatic and start it.

For more information click on this link: http://www.sozohosting.com/knowledge/microsoft-sql-server-database-tips.cfm

PS. Backing up databases is one thing but you should back up your web apps also which you would have a different process for. For critical apps make sure your back ups go off site.



This tip is on web hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

What are the benefits of Cloud Hosting?

Scalability: IT departments that anticipate an increase in user load do not need to scramble to secure additional hardware and software with cloud computing. Instead, an organization can add and subtract capacity as its network load dictates.

Efficiency: Streamline the execution of IT management processes such as provisioning, system capacity management, system availability management, continuity management and service level management.

Implementation: Without the need to purchase hardware, software licenses or implementation services, a company can get its cloud-computing infrastructure up and running in record time — and for a fraction of the cost of an on-premise solution.

Business Needs: The ability to Rapidly provision additional capacity to meet changing business needs.

For more information, click on this Cloud Hosting Link!



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Writing SQL To Perform For Scalability

You should be using SQL Studio management tools such as a profiler and the query tool to analyze the Execution Plan Statistics of your SQL queries so start with the big queries first. If you are using Microsoft SQL Server Management Studio, run a query in the query window, then click on the “QUERY” menu at the top, and select the submenu “DISPAY ESTIMATED EXECUTION PLAN” option. This will bring up a new execution plan tab for you to look at all your SQL queries to make sure they perform. Look not only at the subtree costs but also for table scans. (Table scans are bad for performance). Correct the SQL with new table designs or new indexes and run the same steps above to optimze. Best to use the ACTUAL EXECUTION PLAN when you are finally done.

Here is a link to learn more on Execution Plans:  http://www.simple-talk.com/sql/performance/execution-plan-basics/

For more information click on this link: http://www.sozohosting.com/knowledge/microsoft-sql-server-database-tips.cfm



This tip is on web hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

What is a Wildcard SSL certificate?

Standard SSL Certificates are for 1 domain. Wildcard SSL certificates cover unlimited number of sub-domains. Some SSL vendors actually sell SSL Certificate for a specific number of subdomains. Break even for unlimited number of sub-somains is ususally in the 5-7 domain range which means if you need more than 5-7 subdomain SSL certificates, you are better to buy the wildcard SSL certificate.

Click on SSL Certificates for more information on how SSL certificates are priced for the time period you want them to cover on your web site.



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Installing SQL Server 2008 R2 on your Windows Virtual Private Server

1) Ask SoZo to load the .iso file to your c: drive on your server as SQL Server 2008 will be an additional monthly charge

2) Go to Microsoft download center and download the free file called ISO Mount and save the file to your c: drive

3) Install the ISO Mount file and read the instructions to place the 1 file in the windows/system32 folder adding a desktop icon called ISO Mount

4) Start up this new ISO Mount program and click on the Add drive button and a row in the top window will appear starting with z: drive for mapping to a drive not used

5) Click on the Mount Drive button and select the location of the ISO file in step 1 and just click on the ok button for the pop up as no need to select the 3 check boxes

6) If you open windows explorer now you will see a z:drive (your mapping in step 4) and the files for the install on this drive

7) Start up the setup.exe file for the SQL Server 2008 R2 Install and run the upgrade advisor first to see what issues you will have in upgrading sql server 2000 and 2005 databases

8) Select a new install or a New Server standalone (if not upgrading) or the Upgrade option to upgrade existing older databases on your VPS server

9) Select the default instance or different instance if you have more than 1 instance on your server

10) If you are installing the reporting services select NT Authority/System for the account name and you don’t need to enter a password on that row. You can configure the reporting services later

11) Complete the install

12) You can add on to the install more features after you have installed SQL Server 2008 R2 if you did not install all the features the first time through

13) Click on the ISO Mount program, select the z: drive you added on step 4 above and click on the Remove Mount button



This tip is on web hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

What is an SSL certificate and what is the difference between http:// and https:// for web site addresses?

You should never enter credit card information, or passwords or any other very confidential information on web sites that only start with http:// . https:// at the start of a web site address means an ssl certificate is installed on the site scrambling all transmissions of data you enter in that web site screen. An ssl certificate scrambles the data you enter and then unscrambles it to process it. (In coding language it is called encryption and decryption.) When you login into your account on a web page and see the web site address at the top of your browser changes to https://.. then you are safe with your transactions as you should also see a lock icon show up on your browser.

SSL uses a cryptographic system that uses two keys to encrypt data, first a public key known to everyone and the second is the private key known only to the recipient. SSL an unique and effective way to achieve data/ecommerce security.

Internet trends have boomed in popularity and are creating more opportunities for both commercial and non-commercial sectors. Most people will not submit their private details on the web unless they know the transaction/information they provide would be secure. The best way to provide web security and gain more customers is by installing an SSL certificate to prove the legitimacy of your website.

Click on SSL Certificates for more information on how SSL certificates are priced for the time period you want them to cover on your web site.



This tip is on hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Should I install WordPress Free Blogging Software on Linux Or Windows Web Hosting?

When you go to http://wordpress.org/ to get your free Blogging software, you will find you can install the WordPress Free Blogging Software or either a Linux Web Hosting Plan  or a Windows Hosting Plan as long as both web hosting plans have a access to set up a new mySQL database that the WordPress Bloggging software uses.

We recommend using the Linux Web Hosting Plan since permalinks can be set up using this string:  /%postname% which is not support in a windows install. Using the /%postname% permalinks means you can enter full words in your URL for each post which is good for Search Engine Optimization reasons.

Click on Linux hosting for plans that start at $6.95/month that support this free WordPress blogging software.

 



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Where do I get MS SQL Server Management Studio Express to handle my MS SQL 2005 databases?

Microsoft sql server management studio client tools (Express) can be downloaded for free from

http://www.microsoft.com/download/en/details.aspx?id=8961.

After you have installed this tool on your computer you need 4 pieces of information to login to your database: 1) database IP it is running on, 2) your database name, 3) your database user id, and 4) your database password.



These tips are on MS exhange hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :
I recently subscribed to the new exchange hosting plan (such as SoZo’s Exchange Hosting ) and when I go to outlook to the global address book I do not see anyone in my global address book from my company, I only see old entries.

Close microsoft outlook, do a search on your system for *.oab files, delete all of the found files. Then open outlook and select the down arrow next to send and receive, select the option to download address book.

 

 

I’m recently ran the setup program to connect to the exchange hosting server, this worked correctly but now I want to add some contacts I have to the new contacts folder, how do I do this? I’m using outlook 2007.

Righ click on contacts on the left pane and select import, then import your contacts.

 

 

I want to set up my windows mobile device to use outlook. How do I do this?

You will do this by using microsoft activesync. First install activesync on your mobile device, you can download this from the web. Next follow the steps below.
1.On your device select Start > ActiveSync.
2.In the ActiveSync panel select Menu > Add Server Source.
Enter name of the ActiveSync server:

For exchange 2003 users use: ActiveSync.MyOutlookOnline.com

For exchange 2007 users use: Exch1.Myoutlookonline.com

3.Check “This server requires an encrypted (SSL) connection option.”
4.Press Next.
5.In the User Information panel fill the following fields:
• User name:
• Password: The mailbox password
• Domain: MAIL
6.Check “Enable Save password option.” Press Next.
7.In the Options panel choose the data you want to synchronize with the server.
8.Press Finish.
9.ActiveSync will perform an initial sync.



This tip is on databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

 

How do I load an MS SQL 2005 Database Using MS SQL 2005 Server Management Studio?

 

MS SQL 2005 Server Management Studio is different than doing Imports and Exports with Enterprise Manager (MS SQL 2000). You need to learn how to script the database that you are copying from and then run that DB script on the empty database that you want to import to. Scripting databases is not an easy topic you can learn by reading 1 paragraph here. You need a DB administrator to script a database or buy some good books on the topic.

Just doing a simple Import or Export with MS SQL 2005 Server Management Studio can help you load data initially in your tables but you can lose the identity field increment options on a table if you don’t know what you are doing. However if you have a small database and don’t use identity field increment options or indexes you can do the following steps.

Open MS SQL 2005 Server Management Studio and click on the database you want as the source to copy from. Right click on that database and choose the Tasks menu then the Import Data menu option under that Tasks menu. This will open up the SOURCE dialog box. Leave the Data Source as “SQL NATIVE Client” and change the server name to the source server or source IP. Enter your SQL Server authentication and choose the correct database. Click the next button to open up the DESTINATION dialog box. Leave the Data Source as “SQL NATIVE Client” and change the server name to the destination server or source IP. Enter your SQL Server authentication and choose the correct database. DOUBLE CHECK YOU HAVE THE RIGHT DATABASE. Click the next button to open up the Table/Query Dialog box. Choose either selection however if you are not running a DB script then choose the top option and click Next. Choose the tables you want to import or select the ALL button at the bottom. Click Next to go to the Execution Dialog box. Here you can click Finish to execute the IMPORT or you can save it if you are going to do this import often. You will be notified when the IMPORT is complete.



This tip is on hosting. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

 

How to run several websites under one ip address in apache:

 

1. Install Apache using the following command: yum install httpd

2. Check to see if apache came up properly, browse to the ip address of the server.

3. To configure apache to run several websites on one ip you will need to create the directories first, upload the websites and then modify the httpd.conf .

4. You can create the directories for example under /home , so they would be /home/site1.com/www, /home/site2.com/www and so on and so forth.

5. Once the directories are in place you can now make the following entries at the bottom of the httpd.conf:

:80>
ServerName site1.com
DocumentRoot “/home/site1.com/www”

allow from all
Options +Indexes

:80>
ServerName site2.com
DocumentRoot “/home/site2.com/www”

allow from all
Options +Indexes

6. Also add the following virtual host entry:

# Use name-based virtual hosting.
#
NameVirtualHost :80



This tip is on loading MS MSQ 2000 old databases. We will post a later tip on later MS SQL databases. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

How do I load an MS SQL 2000 Database Using MS 2000 Enterprise Manager?

Open MS 2000 Enterprise Manager and click on the database you want as the source to copy from. Right click on that database and choose the All Tasks menu then the Import Data menu option under that All Tasks menu. This will open up an initial dialog box for you just to click next which will take you to the SOURCE Dialog box. In Source Dialog box leave the top Data Source drop down on “Microsoft OLE DE Provider for SQL Server”.

Change the server dropdown to the source server or source IP. Enter your SQL Server authentication and choose the correct database. Click the next button to open up the DESTINATION dialog box. Leave the Data Source as “Microsoft OLE DE Provider for SQL Server” and change the server dropdown to the destination server or source IP. Enter your SQL Server authentication and choose the correct database.

DOUBLE CHECK YOU HAVE THE RIGHT DATABASE. Click the next button to open up the Table/Copy Dialog box. Choose the bottom selection “Copy ojects and Data Between SQL Server Databases”and click Next. Click on the OPTIONS button and another dialog box will open. UNCHECK the top 3 checkboxes in the top Security Options section and click OK to close this second dialog box. On the remaining dialog box click Next.

To run it immediately chick on the Next button and then finally click on the Finish button to start the import. You will get a status bar of the completion of your import. Failures are typically due to permissions not being granted to you.



We will be posting many tips on managing your database as well as tips on managing your web hosting environment. This tip is on moving SSL certificates in IIS. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

How do I move my SSL certificate from Windows IIS 6 to IIS 7?

You must first export the certificate and private key from IIS 6 into a .pfx file. This file will contain everything you need to move the certificate over to an IIS 7 server.

To export the certificate and private key from IIS 6:

1 – Start > Run and type “MMC” and hit enter

2 – Click File, Add/Remove Snap-in

3 – Click Add

4 – Select “Certificates” and click Add

5 – A wizard will open. Select computer account and click next

6 – Select Local Computer and click finish

7 – Click close

8 – Click Okay

9 – Expand Certificates on the left hand side of the console window

10 – Locate the personal certificate folder, right click on it and select import under all tasks

11 – Locate the certificate you need to export in the personal folder. Right click on it and select export under all tasks.

12 – In the export wizard, select the option to export the private key

13 – Select the file format to be PKCS#12 and check off “Include all certificates in the certification path if possible”

14 – Provide a password for the file and complete the wizard

You can now take the exported .pfx file and move it to the IIS 7 server.

To install the certificate in IIS 7, please follow these instructions:

1 – Start > Run and type “MMC” and hit enter

2 – Click File, Add/Remove Snap-in

3 – Click Add

4 – Select “Certificates” and click Add

5 – A wizard will open. Select computer account and click next

6 – Select Local Computer and click finish

7 – Click close

8 – Click Okay

9 – Expand Certificates on the left hand side of the console window

10 – Locate the personal certificate folder, right click on it and select import under all tasks

11 – Point the wizard to the .pfx file and complete

12 – Open up IIS 7 and click on the site in the left hand connections menu

13 – Under actions, select bindings

14 – Click the Add button to add a new binding

15 – The type will be https, IP address ”All unassigned” and port set to 443

16 – From the SSL certificate drop down, select the cert your just imported through the MMC and click OK

17 – Stop and Start the server.



We will be posting many tips on managing your database as well as tips on managing your web hosting environment. This tip is on SQL Injection so you can learn how to protect your database from hackers. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

How do I stop SQL Injectons In My Application?

SQL injections are performed by hackers using your application code to run SQL statements that you did not plan on. SQL injections can occur if you have edit boxes that allow users to enter some text and then you use that text they entered tacking it on to the end of a standard SQL lookup statement and then run that concatenated SQL statement against your database.

To stop SQL injections, you should first know a lot about SQL commands and how to avoid writing code that lets users run a SQL statement other than what SQL you wanted to perform. You should add client side valiation to your code on all places where users can enter some text into a text box on your application screens. Do not allow the following characters in an input box:

percent sign, greater than sign, less than sign, semi-colon, single quote, double quote….

You also could limit text entered on your application screen’s edit boxes to only be a-z characters, and/or 0-9 digits as that is even more protection.

Click on these links below and read the information for further instructions (like always using stored procedures) on how to protect your websites against SQL injections.

http://msdn.microsoft.com/en-us/library/ms998271.aspx
http://blogs.msdn.com/tom/archive/2008/05/29/sql-injection-and-how-to-avoid-it.aspx



We will be posting many tips on managing your database as well as tips on managing your web hosting environment. This second tip is on Email clean up with your Server email and Microsoft  Outlook. Here you go — free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

 

Automatic Email Clean Up Options With Use of Microsoft Outlook

When you retrieve e-mail messages from a POP3 e-mail account the messages are deleted from the e-mail server by default after they are downloaded to your computer. For many people, this works great. Note: POP3 is a very common protocol that is used to retrieve e-mail messages from an Internet e-mail server.

However, if you need to check your e-mail from multiple computers you use, you must configure Microsoft Outlook to not delete the messages on your e-mail server. This scenario is most common for people who want to check their home Internet service provider (ISP)e-mail account from work and download the messages for permanent storage on their home computer.

When you leave messages on your Hosting e-mail server, you can choose from several options to delete your e-mail messages. To make your choice, you need to consider several factors about your e-mail usage, such as how long you want the e-mail messages to be accessible from multiple computers and the storage limits imposed by your e-mail server administrator. If you exceed your SoZo Hosting storage limit, you might be unable to receive new messages or might be charged additional fees. Typically, it is best to have one computer set to the default setting that doesn’t leave e-mail messages on the e-mail server. When you use the computer to retrieve your e-mail messages, they are downloaded and deleted from the e-mail server. If you choose not to do this, Outlook allows you to select a time duration for leaving e-mail messages on the server.
1.On the Tools menu, click E-mail Accounts.
2.Click View or change existing e-mail accounts, and then click Next.
3.Select your ISP account, and then click Change.
4.Click More Settings.
5.Click the Advanced tab, and under Delivery, select the Leave a copy of messages on the server check box.

6.Select one of the following options:
•Remove from server after x days E-mail messages are downloaded to your computer but remain on the e-mail server for the number of days that you specify. This is the most common setting for people who want to read their messages at work but also download them for permanent storage on their home computer. We recommend that you choose the smallest number of days that suits your needs. The longer you leave messages on your e-mail server, the greater the risk of exceeding your mailbox size quota.
•Remove from server when deleted from ‘Deleted Items’ E-mail messages are downloaded to your computer but also remain on the e-mail server indefinitely until you delete the e-mail message in Outlook and empty the Deleted Items folder. Just deleting the message doesn’t remove the message from the e-mail server.

If you do not select either check box, messages are left on the server indefinitely. You can eventually exceed your mailbox quota, unless you connect to the e-mail server from another computer that has Outlook configured to remove messages from the e-mail server.
7.Click OK, and then click Finish.

 

 

 

 



We will be posting many tips on managing your database as well as tips on managing your web hosting environment. This first tip is on MS SQL Server databases. Here you go —  free on us — compliments of http://www.sozohosting.com/ and also compliments of http://www.biznesstechnologies.com/ :

Web Hosting And Database Tip 1

It is your responsibility to control your MS SQL database log size. If it gets too big for the Size you have allotted then you will get an error in your application. You can fix this different ways. You could run this in a query window but this is a 1 time event:

BACKUP LOG YourDatabase WITH TRUNCATE_ONLY
DBCC SHRINKFILE(YourDatabase_log, 2)

Replace the text “YourDatabase” with your database name and replace the number 2 with the MB size you want to shrink your log file down to. Use 2 as your minimum as that will reduce your database log file to 2 MB. After replacing the text with your database name and setting the MB size of the log file, execute both SQL lines above together.

You could add this SQL call below to call if more often dynamically adding

BACKUP LOG YourDatabase WITH TRUNCATE_ONLY
DBCC SHRINKFILE(YourDatabase_log, 2)

in your application code, replacing the “YourDatabase” text with your database name and setting the size of the log file, and executing this SQL dynamically. Best case is to add these 2 lines of SQL script above to a stored procedure and schedule the stored procedure to run nightly. Of course you want to back your database up before your run this script if you want to maintain a copy of your full sized log file.

Or you could add a stored proc and call it on a regular basis after you run your database backups. Here is an example of a stored proc for MS SQL 2008 databases to shrink the log file to 1 MB:

USE [YourDatabase]
GO
/****** Object: StoredProcedure [dbo].[SRINK_Log_File_To_1MB] Script Date: 12/15/2011 10:00:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SRINK_Log_File_To_1MB] AS
BEGIN

— Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE YourDatabase

SET RECOVERY SIMPLE

— Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (2, 1); — here 2 is the file ID for trasaction log file,you can also mention the log file name (dbname_log)

— Reset the database recovery model.
ALTER DATABASE YourDatabase

SET RECOVERY FULL

END