Zobrazujú sa príspevky s označením SQL Server 2008. Zobraziť všetky príspevky
Zobrazujú sa príspevky s označením SQL Server 2008. Zobraziť všetky príspevky

štvrtok 13. septembra 2012

How to create and enable fulltext for documents on MS SQL Server 2008

This is real working example:
database name = sps
database owner name = sps
table name = DR_BLOBSTORAGE
column name with content = CONTENT
PK = SID
PK index name = DBL_PK

You need to have a table with this three types of columns
CREATE TABLE [dbo].[DR_BLOBSTORAGE](
    [SID] [dbo].[SID] NOT NULL,
    [CONTENT] [image] NULL,
    [DOC_TYPE] [varchar](10) NULL,
 CONSTRAINT [DBL_PK] PRIMARY KEY CLUSTERED
(
    [SID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]




1. Check if fulltext is enabled on the database and enable it.
USE sps
if (select DATABASEPROPERTY(DB_NAME(), N'IsFullTextEnabled')) <> 1
exec sp_fulltext_database N'enable'


2.  Create fulltext catalog with name spsdr_catalog, case insensitive.
CREATE FULLTEXT CATALOG [spsdr_catalog] WITH ACCENT_SENSITIVITY = OFF
AUTHORIZATION [sps]
.

Later, you can manage it here in MS SQL Management Studio


3. Get all languages possible to index.
SELECT * FROM sys.fulltext_languages
 
 3. Create fulltext index
CREATE FULLTEXT INDEX ON [dbo].[DR_BLOBSTORAGE]
(
        CONTENT                         --Full-text index column name
        TYPE COLUMN DOC_TYPE    --Name of column that contains file type information
        Language 1051                 --1051 is LCID for the Slovak language
)
    KEY INDEX DBL_PK
    ON spsdr_catalog
    WITH CHANGE_TRACKING OFF, NO POPULATION;



4. Start population (indexing)
ALTER FULLTEXT INDEX ON [dbo].[DR_BLOBSTORAGE]
   START FULL POPULATION;


5. Check population status:
select objectproperty(object_id('[dbo].[DR_BLOBSTORAGE]'), 'tablefulltextpopulatestatus') as TableFullTextPopulateStatus

0 = Idle.
1 = Full population is in progress.
2 = Incremental population is in progress.
3 = Propagation of tracked changes is in progress.
4 = Background update index is in progress, such as automatic change tracking.
5 = Full-text indexing is throttled or paused. 


Starting status will be 1, but after a while  (depending of  the count of  documents already in database) it will change to 0.

6. Test fulltext search
select * from dr_blobstorage  where  contains(CONTENT,'Test')  

enjoy

MichalC

utorok 3. januára 2012

How to find active session on SQL Server 2008






In the  Microsoft SQL Server Management Studio click on "Activity monitor" - tab Procesess. In the context menu is possible to kill session/process.
Also look on others tabs, you can find many useful informations.



Windows Server 2008 R2 licencing for Virtual and Physical environment

 Windows Server 2008 R2 Standard – A customer licensed with Windows Server 2008 R2 Standard may run one instance of the server software in the physical operating system environment (POSE) and one instance of the server software in a virtual operating system environment (VOSE).  If the customer is running the instance in the VOSE then the instance running in the POSE can only be used to manage the instance of the OS running in the VOSE.

    Windows Server 2008 R2 Enterprise – A customer licensed with Windows Server 2008 R2 Enterprise may run one instance of the server software in the physical operating system environment (POSE) and up to four instances of the server software in the virtual operating system environment (VOSE).  If the customer is running 4 instances in the VOSE then the instance running in the POSE can only be used to manage the 4 instances of the OS running in the VOSE.

    Windows Server 2008 R2 for Datacenter – A customer licensed with Windows Server 2008 R2 Datacenter may run one instance of the server software in the physical operating system environment (POSE) and an unlimited number of instances of the server software in the virtual operating system environment (VOSE).

    Windows Server 2008 R2 for Itanium-based Systems – A customer licensed with Windows Server 2008 R2 for Itanium-based Systems may run one instance of the server software in the physical operating system environment (POSE) and an unlimited number of instances of the server software in the virtual operating system environment (VOSE).

    Windows Web Server 2008 R2 – Windows Web Server 2008 R2 is licensed to a server in the physical operating system environment (POSE).  You can also run as a guest in the virtual operating system environment (VOSE).

    Windows Server 2008 R2 Foundation – Windows Server 2008 R2 Foundation is licensed to a server in the physical operating system environment (POSE).