顯示具有 SQL 標籤的文章。 顯示所有文章
顯示具有 SQL 標籤的文章。 顯示所有文章

2020年7月9日 星期四

MSSQL Reporting Server Services

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/174d4eb1-d4dc-46de-9223-23d063894233/how-to-start-and-stop-ssrs-services-using-windows-scheduler?forum=sqlreportingservices

More help is available by typing NET HELPMSG 2185.


C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\R
eportServer\bin>
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\R
eportServer\bin>net stop ReportServer
The SQL Server Reporting Services (MSSQLSERVER) service is stopping.
The SQL Server Reporting Services (MSSQLSERVER) service was stopped successfully
.


C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\R
eportServer\bin>net start ReportServer
The SQL Server Reporting Services (MSSQLSERVER) service is starting..
The SQL Server Reporting Services (MSSQLSERVER) service was started successfully
.


C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\R
eportServer\bin>

2019年3月13日 星期三

SQL 2008 R2 in recovery mode

https://blog.sqlauthority.com/2015/03/04/sql-server-database-stuck-in-in-recovery-mode-after-restart/

Should because dischage and archive a 200 and 400+ days patient cause SQL back end running

when not yet finish and log increase to huge size. at this moment i reboot. so after reboot both prxdb and prxdbarchive also show  " prxdb (in reocovery)" wait for a while . And windows eventlog show prxdb recovery and for a while.

2019年3月1日 星期五

How to drop replication once I dropped the Distribution database by mistake??

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9b75baaa-317b-4617-9941-08a45f2189a0/how-to-drop-replication-once-i-dropped-the-distribution-database-by-mistake?forum=sqlreplication

2018年9月19日 星期三

sql 2008 reportdb detach

What does “Drop Connections” and “Update Statistics” in the “Detach Database” dialog do?

Drop Connections will force the database into Single User mode before detaching the database, thereby forcing all users to disconnect. If you don't check-mark that option, and users are connected to the database, the database will not be detached.

Update Statistics will refresh any out of date statistics before detaching the database. If you leave this option un-checked, statistics objects will remain as they were at the time you detached the database

在 SQL Server 中如何成功卸離資料庫


同場加映

How long will a database detach take?

Pareng Joseph...musta na?ang dbWizards?

A detach time depends on how big the database is.  In our environment (average 50-100GB database size) we don't do detach regularly as it takes on the average 5-20 mins.  You mentioned that your transaction log files grow very big.  There are a lot of reasons why the database files grow very big.  A few of them are:

• Uncommitted Transactions
• Extremely Large Transactions
• Operations: DBCC DBREINDEX and CREATE INDEX
• While Restoring from Transaction Log Backups
• Client Applications Do Not Process All Results
• Queries Time Out Before a Transaction Log Completes the Expansion and You Receive False 'Log Full' Error Messages
• Unreplicated Transactions

What we do is we monitor the databases on what is causing the transaction log file of a database to grow unexpectedly.  After finding the root cause, we resolve accordingly.  A recent issue in our environment indicates that the application codes are not committing transactions properly.  So we asked our application vendor to modify the application which eventually solved the problem.

For more details on transaction log files growing unexpectedly, see http://support.microsoft.com/kb/317375/


2018年5月16日 星期三

Listing information about all database files in SQL Server in MB size

https://stackoverflow.com/questions/43472717/get-actual-database-size-in-sql-server-2012-in-gb
https://stackoverflow.com/questions/27057000/sql-server-get-all-databases-with-mdf-and-ldf-file-location

SELECT
    db.name AS DBName,
    type_desc AS FileType, size * 8/1024 AS MBSize,
    Physical_Name AS Location
FROM
    sys.master_files mf
INNER JOIN 
    sys.databases db ON db.database_id = mf.database_id

Table Size
https://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database


Here is another method: using SQL Server Management Studio, in Object Explorer, go to your database and select Tables




Then open the Object Explorer Details (either by pressing F7 or going to View->Object Explorer Details). In the object explorer details page, right click on the column header and enable the columns that you would like to see in the page. You can sort the data by any column too.

2018年1月18日 星期四

sp_addlinkedserver SQL 2008

Test Server for PWHOT1 VM clone and change computer name and SQL Server name. but DBLink Connect still old.


select name from sys.servers
select * from sys.servers


sp_dropserver 'PWHOTRPT'
GO

-Add DB Link Server
EXEC sp_addlinkedserver
@server = 'PWHOTRPDRATEST', --Server Name
@srvproduct = 'MS SQL',    <------  on other web said 'SQL Server' , but cannot execute
@datasrc = 'PWHOTRPDRATEST' , --Server IP or Hostname
@provider = 'SQLNCLI'

select name from sys.servers
select * from sys.servers


https://dotblogs.com.tw/puma/2009/02/05/7038
http://tsuozoe.pixnet.net/blog/post/22417837-sp_addlinkedserver-%E3%80%81-sp_dropserver-%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95-
https://stackoverflow.com/questions/35799905/could-not-find-server-server-name-in-sys-servers-sql-server-2014

2017年7月19日 星期三

mirth pwhot using pre-caution

http://unicolet.blogspot.hk/2012/08/mirth-recover-space-when-mirthdb-grows.html

appdata\mirthdb\seg0

C:\Program Files\Mirth Connect\appdata\mirthdb\seg0

https://www.experts-exchange.com/questions/28694112/Derby-Database-Seg0-folder-dat-files-growing-too-large.html

Author Commentby:robthomas09
ID: 409026422015-07-28
I ended up uninstalling Mirth after exporting my channels and reinstalling mirth and all of the space freed up.


mirth 191.1.1.183 make no space for PWHOT1


As noted on our wiki, the embedded Derby database is not recommended for production use. It's meant for quick deployment, development, and testing. For production use, you should switch to one of the other supported databases (PostgreSQL, MySQL, Oracle, or SQL Server).
__________________

http://www.mirthcorp.com/community/wiki/display/mirth/System+Requirements

ePR unsubscribe

Aim to create message auto from sequential database then send

Caution , UNDEPLOY the channel after run. else 1) restart mirth will redepoly 2) keep creating file in high speed in your local harddrive. 3) eat up all your harddisk space 4) hang the mirth and no way to delete


  ALTER TABLE [PWHOT].[dbo].[sheet1]
   ALTER COLUMN patient_key nvarchar(50)

ALTER TABLE dbo.YourTable
   ALTER COLUMN YourColumnName BIT
 

How to change column datatype in SQL database without losing data


Hints: on DB Quere you can remove "[]"

How to use the Mirth Transformer

Hints :https://www.youtube.com/watch?v=nTAmnfLMO0A

SELECT a.userID, b.usersFirstName, b.usersLastName  FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b  ON a.userID=b.userID

PHHOT.dbo.sheet1 = [PHHOT].[dbo].[sheet1]

Hints: java.lang.Thread.sleep(5000) on Mirth -> Destinations -> Step

How to create a table from select query result in SQL Server 2008 [duplicate]

Hints : SELECT * INTO NewTable FROM OldTable

Convert XML to HL7 messages using Mirth Connect

Hints : http://irwinj.blogspot.hk/2008/12/getting-started-with-mirth-part-1.html

HINTS: Trace: • Mirth Connect Introduction and Tutorial
http://wiki.patesco.ca/doku.php?id=hl7:mirth:tutorial

HINTS : https://amarnathks.wordpress.com/tag/mirth-beginner-tutorial/

Enable Run On Update Statement if you wish to update something after reading data from table. Here i have updated the status flag to 1 such that those details will not be read again. You can now see the selected data values in the right side of On Update SQL.


question : Is it possible to configure the File Writer to create a file name based on the PID.2 segment (chart ID) so each patient account would have it's own file for ADT messages?

HINTS: http://www.mirthproject.org/community/forums/showthread.php?t=11120
Yes, definitely. Extract the PID.2 out into a map variable, and then in the destination settings just drag your map variable into the Filename field

Transformer -> New Step -> Mapper -> change this step to "Channel Global Map"" -> set variable as filenamePatKey , and Mapping as msg['pmhgoodresult_patient_key'].toString()
then
Destination -> file writer -> on right side " Destination Mapping " you can find filenamePatKey you just create

question : mirth database reader endless loop

HINTS : isdone flag on DB for notice

2017年6月21日 星期三

sql to reduce/shrink LDF file size in SQL Server

To reduce the .ldf file, you must do three things:

  • Backup the database
  • Stop the database service
  • Shrink the .ldf file




SELECT name, physical_name AS current_file_location
FROM sys.master_files

Following is the output of files used by my SQL Server instance.

-------

Bill_Ryan
Jalapeno
Best Answer
Bill_Ryan  
In  Server Management Studio Right click on the database in question and go to Properties:
  • Go to "Options" on the left
  • Change the line "Recovery Model:" from Full to "Simple" and hit OK
  • Right click on the database again, go to Tasks - Shrink - Files
  • Under File Type: select Log and click OK
This will temporarily free up space for you, make sure that your database is set to back up and that its configured to empty the log after back up. Once you have resolved the space issue and made sure your log file is set to flush after backups, I recommend you put the recovery model back on Full. If it was already set to flush the log after backup, check to see why the backups aren't being done...
GerardMainardi
Datil
GerardMainardi  
Do you NEED that log?  If so, you've certainly got a problem.
Otherwise, you can go the ghetto solution that will take care of it in the short-term: change the database recovery model to simple, then change it back and set a new log size. (Right click database, properties, options, recovery model).
Let me know if you need more detailed instructions than this.  You'll lose all that transaction log, but this will do it.
EDIT: Bill beat me to it

2016年2月17日 星期三