SQL Server 2008 R2 - Unable to rebuild master database, Cannot shutdown service - sql-server-2008-r2

Yesterday I noticed I could not execute any query within the master database. I tried a DBCC CHECKDB but this just hung (let it run for 24 hours). I was unable to stop the SQL Server service: "The service cannot accept control messages at this time"
I decided to try to rebuild the master database: setup /ACTION=REBUILDDATABASE /QUIET /INSTANCENAME=MYINSTANCE /SQLSYSADMINACCOUNTS=MYACCOUNT /SAPWD=MYPASSWORD
Summary.txt seems to indicate the same problem:
Detailed results:
Feature: Database Engine Services
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Failed: see details below
Configuration error code: 0x0A2FBD17#1211#1
Configuration error description: The service cannot accept control messages at this time.
Configuration log: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140517_091501\Detail.txt
It looks like the SQL Server cannot be shutdown. What can I do about this?

"SHUTDOWN WITH NOWAIT" looks to have fixed the problem.

Related

Appsmith server is not starting because of MongoDB exception

My Appsmith instance just upgraded to v1.6.4 and it's not booting up anymore. In the logs, I can see the exception below:
Caused by: com.mongodb.MongoCommandException: Command failed with error 17 (ProtocolError): 'Attempt to switch database target during SASL authentication.' on server mongo:27017. The full response is {"ok": 0.0, "errmsg": "Attempt to switch database target during SASL authentication.", "code": 17, "codeName": "ProtocolError"}
Is there anything I can do to bring up my Appsmith instance?
This is a breaking change that was introduced in v1.6.4 of Appsmith because of Spring library upgrades. A complete fix is described at: https://docs.appsmith.com/troubleshooting-guide/deployment-errors#server-not-booting-because-of-mongocommandexception
Step 1: Edit MongoDB URI
Adding &authSource=admin to the end of your APPSMITH_MONGODB_URI variable’s value in your docker.env file. For example, in your docker.env file, if you have the following line:
# Old config
APPSMITH_MONGODB_URI=mongodb://<your_username>:<your_password>#mongo/appsmith?retryWrites=true
Change it to the following (notice the only change is &authSource=admin. Do NOT copy-paste this whole line. Only add the &authSource=admin part to your existing value.
# New config
APPSMITH_MONGODB_URI=mongodb://<your_username>:<your_password>#mongo/appsmith?retryWrites=true&authSource=admin
Save the file.
Step 2: Restart server
Now restart your container with the following command:
sudo docker-compose up -d --force-recreate appsmith-internal-server
In a minute or two, the server should now come up and be ready.

GCloud SQL Proxy cannot connect, unclear errors

I am having difficulty getting the gcloud sql proxy working on my local machine. I have gone through all the steps here however I am getting the following errors. It is unclear to me what is actually going wrong. Important things to note, I am not using a service account, I am authenticating with my own account through gcloud auth login and I am following the TCP sockets steps.
MySQL
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
GCloud SQL Proxy
couldn't connect to "<my instance connection name>": googleapi: Error 400: This operation isn"t valid for this instance., invalidOperation
GCloud Logs
... status: {
code: 2
message: "UNKNOWN"
}
}
receiveTimestamp: "2017-09-08T15:45:10.179994989Z"
resource: {…}
severity: "ERROR"
timestamp: "2017-09-08T15:45:04.289Z"
}
The most likely reason you are receiving this error message is because you are using a First Generation instance.
Proxy connectivity is only supported for Second Generation instances.

Cannot deploy war to GlassFish 4.1.2 server because database can't be found

I'm working through a book on GlassFish4 application server and have trouble deploying a sample war to the server. The server says:
"Error occurred during deployment: Exception while deploying the app [jpaintro-1.0] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: The connection was refused because the database customerdb was not found. Error Code: 0. Please see server.log for more details."
The database server is Derby that comes with GlassFish. The database was created with this from the ./ij prompt:
connect 'jdbc:derby://localhost:1527/customerdb;create=true';
Next I could logon:
connect 'jdbc:derby://localhost:1527/customerdb;user=dev;password=dev';
and successfully enter table creation data and insert table data. Next I could retrieve this data with SQL. All fine, so the database exists.
Physical location database:
/home/fedora/GlassFish/glassfish4/glassfish/databases/1527/customerdb
The DERBY_HOME environment value was set.
I had to set up the following resources from the command line prompt:
./asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --property DatabaseName=customerdb:User=dev:password=dev CustomerDBPool
./asadmin create-jdbc-resource --connectionpoolid CustomerDBPool jdbc/__CustomerDBPool
And I could verify in the GlassFish console that they were created successfully. The JDBC connection pool does indeed have an entry CustomerDBPool with an "additional property" name=DatabaseName, value=customerdb as well as user/password dev/dev. Also in the console is a JDBC resource with JNDI name jdbc/__CustomerDBPool and pool name CustomerDBPool
The war-file that I can't deploy contains a JPA-entity Customer and CDI named bean JpaDemoBean. The latter constructs a few Customer object and persists them to the database.
In the persistence.xml there is merely a jta-data-source element with value jdbc/__CustomerDBPool
I am all following literally "from the book".
Now why can't I deploy the war?
And all of a sudden I can't connect to the database via command line tool ij either:
ERROR 08004: The connection was refused because the database customerdb was not found.
I can stop and start the database server from the command line, but during startup I get the message:
"Invalid database home directory: /home/fedora/GlassFish/glassfish4/glassfish/databases"
Nevertheless the startup process continues and says it started the database successfully.
Thanks in advance!

Entity framework with db mode cannot connect to server

I am trying to connect to by db instance using db first, I created a connection
<add name="Entities"
connectionString="metadata=res://*/Models.ModelCmarket.csdl|res://*/Models.ModelCmarket.ssdl|res://*/Models.ModelCmarket.msl;provider=System.Data.SqlClient;provider connection string="data source=(localdb)\v12.0;initial catalog=Cevaheer;integrated security=True;trustservercertificate=False;multisubnetfailover=True;MultipleActiveResultSets=True;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
And I always get an error -
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.)
But if i try
<add name="CevhermarketEntities"
connectionString="Data source=(localdb)\v12.0;initial catalog=Cevaheer;integrated security=True;trustservercertificate=False;multisubnetfailover=True;MultipleActiveResultSets=True;user id=dbuser;password=flexsin#123!;multipleactiveresultsets=True;"
providerName="System.Data.SqlClient" />
I can connect, and also can connect from VS sql server explorer and SSMS.
To begin - there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred, before you begin you need to rename the v11 or v12 to (localdb)\mssqllocaldb
You dont have the services running
You don't have the firelwall ports here
configured
Your install has and issue/corrupt (the steps below help give you a nice clean start)
You did not rename the V11 or 12 to mssqllocaldb
I found that the simplest is to do the below - I have attached the pics and steps for help.
First verify which instance you have installed, you can do this by checking the registry and by running cmd
cmd> Sqllocaldb.exe i
cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"
if this step fails, you can delete with option d cmd> Sqllocaldb.exe d "someDb"
cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb" create - the pic is error
cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"

Hsqldb Server, alias does not exist

According to the log the server was startet with alias "myrepos" as expected.
But if I try to connect to this alias, I get an error, also visible in the log (last line).
What could be the cause?
[Server#28fc19eb]: Initiating startup sequence...
[Server#28fc19eb]: Server socket opened successfully in 6 ms.
[Server#28fc19eb]: Database [index=0, id=0, db=file:/Users/t..../myrepos, alias=myrepos ] opened sucessfully in 1238 ms.
[Server#28fc19eb]: Startup sequence completed in 1247 ms.
[Server#28fc19eb]: 2016-04-08 10:32:33.871 HSQLDB server 2.3.3 is online on port 9001
[Server#28fc19eb]: To close normally, connect and execute SHUTDOWN SQL
[Server#28fc19eb]: From command line, use [Ctrl]+[C] to abort abruptly
[Server#28fc19eb]: [Thread[HSQLDB Connection #2304d78b,5,HSQLDB Connections #28fc19eb]]: database alias=myrepos does not exist
Solved. I had spaces behind the database name in my configuration, which had been incorporated to the alias: 'alias=myrepos ]'
So, the alias actually wasn't "myrepos" but "myrepos "