NAV Italian People Blog


Roberto Stefanetti Blog, NAV Senior System Engineer, My NAV e SQL Server Blog

Archivio Posts
Anno 2013

Anno 2012

Anno 2011

Anno 2010

Anno 2009

Anno 2008

Anno 2007

Sql Server reset "db owner" lost on database

Sql Server reset "db owner" lost on database  USE Database exec sp_changedbowner 'sa', true    >> reassign user "sa" on user dbo lost on database   
Leggi tutto il post...
Categoria: Sql Server ALL
venerdì, 18 gen 2013 Ore. 14.04

Kill sessioni NAV dormienti (escluso WEB services) senza transazioni aperte da piu di 20 minuti

-- Kill sessioni NAV (escluso WEB) dormienti senza transazioni aperte da piu di 20 minuti USE ER_P DECLARE @v_spid INTDECLARE c_Users CURSORFAST_FORWARD FOR SELECT spid   FROM master..sysprocesses (NOLOCK)   WHERE spid>50      AND (program_name LIKE N'%Microsoft Dynamics NAV%') AND (program_name not like N'%Microsoft Dynamics NAV WEB%')   AND status='sleeping'   AND DATEDIFF(mi,last_batch,GETDATE())>20   AND spid<& 
Leggi tutto il post...
Categoria: Sql Server ALL
lunedì, 14 gen 2013 Ore. 12.40

List all processes running on SQL Server

-- List all processes running on SQL Server SELECT [Database]=DB_NAME(dbid), spid, last_batch, status, hostname, loginame FROM sys.sysprocesses WHERE dbid = DB_ID('ER_P');  
Leggi tutto il post...
Categoria: Sql Server ALL
lunedì, 14 gen 2013 Ore. 11.35

Trasferimento di accessi e password tra istanze di SQL Server

Trasferimento di accessi e password tra istanze di SQL Server Aprire una nuova finestra dell'Editor di Query e quindi eseguire lo script seguente. USE master GO IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL DROP PROCEDURE sp_hexadecimal GO CREATE PROCEDURE sp_hexadecimal @binvalue varbinary(256), @hexvalue varchar (514) OUTPUT AS DECLARE @charvalue varchar (514) DECLARE @i int DECLARE @length int DECLARE @hexstring char(16) SELECT @char 
Leggi tutto il post...
Categoria: Sql Server ALL
giovedì, 18 ott 2012 Ore. 16.51

High Performance SQL Views Using WITH(NOLOCK)

High Performance SQL Views Using WITH(NOLOCK) Every now and then you find a simple way to make everything much faster. We often find customers creating data warehouses or OLAP cubes even though they have a relatively small amount of data (a few gigs) compared to their server memory. If you have more server memory than the size of your database or working set, nearly any aggregate query should run in a second or less. In some situations there may be high traffic on from the transactional a 
Leggi tutto il post...
Categoria: Sql Server ALL
giovedì, 18 ott 2012 Ore. 15.51

Come visualizzare le 50 query più pesanti - Sql Server

SELECT TOP 50 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.total_logical_writes, qs.last_logical_writes, qs.total_worker_time, qs.last_worker_time, qs.total_elapsed_time/1000000 total_elapsed_time_in_S, qs.last_elapsed_time/1000000 last_elapsed_time_in_S, qs.last_execution_ti 
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 14 feb 2012 Ore. 14.04

SQLCMD utility

L'utilità SQLCMD è scritta in .NET 2.0 e comunica con SQL Server via Client SQL Nativo oppure via ODBC. Fornisce un ambiente di scripting ricco di funzionalità (tra cui una primitiva gestione degli errori) in grado di mettere l'utente nelle condizioni di compiere sul server attività di elevata complessità. È uno strumento poliedrico, perchè sia l'amministratore di sistema (per la creazione di script di manutenzione per database o tabelle) sia lo sviluppatore (per la creazione di sofisticati wiz 
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 25 ott 2011 Ore. 12.17

Designing Reports in Report Designer and Report Builder 3.0

Report Builder and Report Designer Features The following table summarizes differences in the two report authoring environments for typically used features. Area Report Builder 3.0 Report Designer Description Report Builder is a report authoring environment for business users who prefer to work in the Microsoft Office environment. You work with one report at a time. You can modify a published report directly from a report server. You can quickly build a repo 
Leggi tutto il post...
Categoria: Sql Server ALL
lunedì, 24 ott 2011 Ore. 13.34

How to transfer the logins and the passwords between instances of SQL Server

To transfer the logins and the passwords from the instance of SQL Server on server A to the instance of SQL Server on server B, follow these steps: 1. On server A, start SQL Server Management Studio, and then connect to the instance of SQL Server from which you moved the database. 2. Open a new Query Editor window, and then run the following scriptUSE masterGOIF OBJECT_ID ('sp_hexadecimal') IS NOT NULLDROP PROCEDURE sp_hexadecimalGOCREATE PROCEDURE sp_hexadecimal@binvalue varbinary(256),@hexva 
Leggi tutto il post...
Categoria: Sql Server ALL
sabato, 24 set 2011 Ore. 20.57

SQL CLEAN AUTO STATS & CREATE NEW

Well, the "Auto. Create Stats" and also "Auto. Update Stats" could be a real pain; I recommend to disable it. THe sufficiently maintain the required statistics you could implement a SQL Agent Job (or TSQL task for the MP) doing this: use [MyNAVdb]goexec sp_updatestatsgo exec sp_createstats 'indexonly' To get rid of the already existing auto-stats, you could exec this script (part of the NAV/SQL Performance Toolbox) declare @id int, @name varchar(128), @statement nvarchar(1000)declare stat 
Leggi tutto il post...
Categoria: Sql Server ALL
mercoledì, 21 set 2011 Ore. 09.48

Install & Config "xp_ndo_enumusergroups", "xp_ndo_enumusersids" NAV SQL extended stored procedures

Install & Config "xp_ndo_enumusergroups", "xp_ndo_enumusersids" NAV SQL extended stored procedures USE master EXEC sp_addextendedproc xp_ndo_enumusergroups, 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\xp_ndo_64.dll' GO GRANT EXECUTE ON [xp_ndo_enumusergroups] TO PUBLIC GO USE master EXEC sp_addextendedproc xp_ndo_enumusersids, 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\xp_ndo_64.dll' GO GRANT EXECUTE ON [xp_ndo_enumusersids] TO PUBLIC GO 
Leggi tutto il post...
Categoria: Sql Server ALL
mercoledì, 31 ago 2011 Ore. 15.13

[Miscrosoft][ODBC SQL Server Driver]Unspecified error occurred on SQL Server

[Miscrosoft][ODBC SQL Server Driver]Unspecified error occurred on SQL Server The following ODBC error occurred: Error: [Miscrosoft][ODBC SQL Server Driver]Unspecified error occurred on SQL Server.Connection may have been terminated by the server. State ID: HY000 Scenario:NAV on SQL Server Problem:Security permissions lost or not loaded Solution> verify free space on Data\Log Disks> compact SQL LOG FILE> restart SQL SERVER (resolve log errors) 
Leggi tutto il post...
Categoria: Sql Server ALL
venerdì, 08 lug 2011 Ore. 11.45

Compattare il TempDb (annche con transazioni aperte)

Compattare il TempDb  (annche con transazioni aperte)   USE tempdb GO   CHECKPOINT                                                                  &n 
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 10 mag 2011 Ore. 14.43

TempDb is full

TempDb is fullCome liberare lo spazio quando il TempDB è pieno. Errrore windows registry > Source: MSSQLSERVER Event ID: 17052 Description: The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space TempDb Verifica spazio occupato dalle tabelle temporanee USE tempdb GO EXEC sp_spaceused  The following should give you some clues as to which table(s) consume most of the space in the data file(s) this will help you narrow down any 
Leggi tutto il post...
Categoria: Sql Server ALL
venerdì, 06 mag 2011 Ore. 09.30

SQL Database MAIL per notifiche Jobs, Stored Procedure per Invio Mail SMTP

Bellissimo articolo su come utilizzare "SQL Database MAIL" per inviare notifiche dei job in esecuzione   http://community.dotnetwork.it/sabrina/archive/2010/09/16/configurare-sql-server-database-mail-per-lrsquoinvio-delle-notifiche-dei.aspx Complimenti all'autore, articolo veramente ben fatto.   Questo articolo invece + utile per mandare mai via SMTP (basato su stored procedure) Sending Automated Job Email Notifications in SQL Server with SMTP http://www.howtogeek.com/howto/d 
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 12 apr 2011 Ore. 15.23

Porting Database SQL Serrver (da SQL2000 a SQL2008R2)

Porting Database SQL Serrver (da SQL2000 a SQL2008R2) SCENARIOportare un database da SQL2000 a SQL2008 R2:è possibile fare un restore dal formato SQL2000 al formato SQL2008R2, non viene controllata versioningcome avviene invece per versioni più recenti. PASSI DA SEGUIRE1) Prendere un backup del Db 20002) Creare un nuovo db su SQL 2008 R2 tramite "ripristino" TUNING DOPO UPGRADE RELEASEDopo aver eseguito un  restore di un backup SQL Server 2000 su una istanza 2005, 2008 o 2008 R2 seguire  
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 15 feb 2011 Ore. 14.45

MSDN Scripts for SQL Indexes Maintenance

MSDN Scripts for SQL Indexes Maintenance /* Depending on fragmentation index level appropriated action will be taken (no action, rebuild or reorganize) If average fragmentation is less than 10% no action will be taken, if average fragmentation is between 10% and 30% index will be reorganized, finally if index average fragmentation is greater than 30% index will be rebuilt. analisi per defrag Indice > 30% MSND Scripts Stored Procedure*/   USE [DATABASE] GO   SET  
Leggi tutto il post...
Categoria: Sql Server ALL
venerdì, 28 gen 2011 Ore. 11.29

Truncate the database and shrink the database

Truncating Log Files   Truncate the database and shrink the databaseThe following set of SQL will shrink your database and “truncate” the log file. File in the parmaters surrounded by <…>.  Note that you’ll need the two filename values from step 1. USE <yourdatabasename>GOBACKUP LOG <yourdatabasename> WITH TRUNCATE_ONLYGODBCC SHRINKFILE (<yourdatabaselogfilename>, 1)GODBCC SHRINKFILE (<yourdatabasedatafilename>, 1)GOexec sp_helpfile 
Leggi tutto il post...
Categoria: Sql Server ALL
martedì, 11 gen 2011 Ore. 16.00

Vista di sistema "INFORMATION_SCHEMA.VIEW_TABLE_USAGE" SQL 2005

La Vista di sistema  INFORMATION_SCHEMA.VIEW_TABLE_USAGE  per SQL2005,2008 fornisce "un'elenco delle Tabelle utilizzate nelle Viste presenti sul database" utilissimo per capire DOVE sono utilizzate le tabelle (es: x fare Rollback engeneering) Campi: VIEW_CATALOG (nvarchar(128), NULL)VIEW_SCHEMA (nvarchar(128)), NULL)VIEW_NAME (sysname(nvarchar(128)), NOT NULL)TABLE_CATALOG (nvarchar(128), NULL)TABLE_SCHEMA (nvarchar(128), NULL)TABLE_NAME (sysname(nvarchar(128)), NOT NULL)VIEW_C 
Leggi tutto il post...
Categoria: Sql Server ALL
giovedì, 30 dic 2010 Ore. 17.02

SQL Demo Samples

Sample Databases SQL Server 2008R2 product sample databases are now available.SQL Azure sample databases are now available.SQL Server 2008 product sample databases are still available. If you are having difficulties with the current installer, please see Database Installer Help.SQL Server 2005 product sample databases are still available.Got questions? Want to contribute? Check out the SQL Server Community & Samples Discussion Forum! LINK http://msftdbprodsamples.codeplex.com/  
Leggi tutto il post...
Categoria: Sql Server ALL
lunedì, 18 ott 2010 Ore. 11.46




Statistiche
  • Views Home Page: 80.756
  • Views Posts: 194.492
  • Views Gallerie: 340
  • n° Posts: 283
  • n° Commenti: 21
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003