"The connection has been reset" - drupal-7

I have copied a Drupal site from a live server to a test environment in order to do further development. I have set this up in a WAMP environment, importerted databases successfully and setup af a virtual host for the site.
I can connect to the site without problems and login. When I want to access the admin pages, I get the following message from the browser (http://www.MYSITE.local/da/admin/modules):
The connection has been reset
Firefox reports the request as "Aborted" when I inspect Firebug's Net.
There are no errors in the Apache log files. Also, I have enabled PHP errors for debugging, and nothing is displayed.
I have reset cache, looked for compression settings for CSS and Javascript in phpMyAdmin, but not found any I could disable.
Help is much appriciated!

After a migration if you are facing problem, then run rebuild_registry and its solved. Please note that its not a module for drupal. It is available as a very helpful submodule for drush.
I highly recommend installing drush manually for windows. Follow the instruction to install drush.
After installation run,
drush dl registry_rebuild
It doesn't matter from which directory you run this command, since its a drush extention and not a drupal extention. Drush will download the required files and place it in the appropriate location.
once its done, you can visit your sites folder and run
drush rr
That should rebuild the registry and clear the cache. Most of the migration issues are fixed automatcially. Please leave a comment if it doesn't fix your issue.

If it didn't help - like in my case, add following code to your httpd.conf This will increase the stack size (default 1MB)
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>

Truncate manually all caches table and the sessions one could solve:
for example:
Truncate table myprefix_cache;
Truncate table myprefix_cache_admin_menu;
Truncate table myprefix_cache_block;
Truncate table myprefix_cache_bootstrap;
Truncate table myprefix_cache_field;
Truncate table myprefix_cache_filter;
Truncate table myprefix_cache_form;
Truncate table myprefix_cache_image;
Truncate table myprefix_cache_l10n_update;
Truncate table myprefix_cache_libraries;
Truncate table myprefix_cache_media_xml;
Truncate table myprefix_cache_menu;
Truncate table myprefix_cache_page;
Truncate table myprefix_cache_path;
Truncate table myprefix_cache_rules;
Truncate table myprefix_cache_token;
Truncate table myprefix_cache_update;
Truncate table myprefix_cache_variable;
Truncate table myprefix_cache_views;
Truncate table myprefix_cache_views_data;
Truncate table myprefix_sessions;

I fixed that by visiting Performance and disabling Aggregate and Compress CSS.

Related

postgresql restoring from dumpall file. Indexes and Constraints not being created

I'm upgrading from and old psql version to a newer (9.5 to 15 (for Ubuntu 20.04)) and when i'm trying to restore from dumpfile everything seems fine except that indexes are not being created.
I made the dumpfile by doing
pg_dumpall > dbdump.dump
Then, after upgrading cluster and everything i'm restoring the DB by doing
psql -f dbdump.dump postgres as suggested by PostgreSQL Documentation.
When i check indexes with select * from pg_indexes where tablename not like 'pg%'; there's nothing.
There should be at least 10K+ of indexes (yes, the DB has more than 10K tables, so creating the indexes by hand is not an option)
What could be wrong?
In this case you should check the PostgreSQL log file. If the restore fails, there must be an error in the log file, or even in the console. There are a few more details that would help clarify the situation. For example, are you using a GUI tool for restoring? Or are you running the command from the CLI?

Synchronize database files with the database - PostgreSQL

First forgive me for my English. It is a little bad. Second forgive my ignorance, i'm newiest in postgres
I'm having trouble when I try to up a backup database on another database. I need to dump the database just to get one table, but I only have the files that was in /var/lib/pgsql/data/base/
Here what I try:
I create a database named "test" with OID 227763 so I put the files of the old database to this new database with another OID. I fix the folder and files permissions, but when I log into "test" and run select * from pg_tables; the tables does not appears to me. And when I try to create the table on PhpPgAdmin, I got
ERROR: relation already exists
I'm trying to do this because I need to know which of this files is the table that i want. I will log into database and run SELECT oid,* from pg_class; to get the OID.
I found the old OID database in /var/lib/pgsql/data/global/pg_database
If anyone can help me, I thank you.
There are many ways to backup and restore an entire database or a single table. It sounds like you need to be using pgDump instead of working on individual files. A file level copy is likely to corrupt your database if not in backup mode and if not copying the entire thing + archive logs.
If you MUST copy it by files, make sure the database is shut down for maximum safety.
For me, if I had one table to backup, I'd use pg_dump
pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}
you can use the -t flag to list a single table if you like.

Quartz.net in Azure: "tables without a clustered index are not supported" when deleting a job

I spent the better part of the day trying to get Quartz.net to run in an Azure worker role. It uses an SQL Azure instance as its persistent store.
The configuration I've got is this the following:
quartz.jobStore.type=Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.driverDelegateType=Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz
quartz.jobStore.tablePrefix=QRTZ_
quartz.jobStore.dataSource=myDS
quartz.dataSource.myDS.connectionString=Server=xxx,1433;Database=xxx;User ID=xxx#xxx;Password=xxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
quartz.dataSource.myDS.provider=SqlServer-20
To create the schema, I used the scripts that came in the Quartz.net zip file. Actually, I tried two of them:
tables_sqlServer.sql,
tables_sqlServerCe.sql
They were in the Quartz.NET-2.2.1.zip I downloaded. I had to remove ON [PRIMARY] in the ALTER TABLE statements of the first script in order to get it to work; otherwise it complained about 'Filegroup reference and partitioning scheme' is not supported in this version of SQL Server.'
The second one worked without modifications.
Whichever script I use to create the schema, Quartz.net throws an error when I try to delete a job:
"Couldn't remove trigger: Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again."
I'm able to add jobs (I can see the rows being added to the DB) but whenever I try to delete one, Quartz.net throws a fit.
What can I do to fix this?
Thanks!
I've updated and ran smoke tests for script alterations that should make it work on SQL Azure, the latest script is available here:
https://raw.github.com/quartznet/quartznet/master/database/tables/tables_sqlServer.sql

Clone an existing database to a new database

I'm struggling to find a suitable solution to this. I have a fairly large SQL Server 2008 Express database containing 60+ tables (many with key constraints) and a whole bunch of data.
I need to essentially copy all of these tables and the data and the constraints exactly from one database to another. I'm basically duplicating website A - to produce an exact copy (website B) on a different domain so we end up with two completely identical websites running in parallel, each with their own identical database to begin with.
Database A is up and running on website A. Database B is set up and has it's own user. I just need to get the tables and the data intact from A to B. I can them modify my web.config connection to use the log-in credentials for database B and it should work.
I've tried backing up database A and restoring to database B via Management Studio Express, but it tells me:
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'database-B' database.
(Microsoft.SqlServer.Smo)
I've also tried right clicking database A in Management Studio Express and going to Tasks > Generate scripts. But when I do this and run the SQL scripts on database B I get a whole load of errors to do with foreign keys etc as it imports the content. It seems like it's doing the right thing, but can't handle the different keys/relationships.
So does anyone know of a simple, sure-fire way of getting my data 100% exact and intact from database A to database B?
I think I used SQL Server Database Publishing Wizard to do something like this about 5 years ago, but that product seems to be defunct now - I tried to install it and it wanted me to regress my version of SQL Server to 2005, so I'm not going there!
Don't use the UI for this. If you're not familiar with the various aspects of BACKUP/RESTORE the UI is just going to lead you down the wrong path for a lot of options. The simplest backup command would be:
BACKUP DATABASE dbname TO DISK = 'C:\some folder\dbname.bak' WITH INIT;
Now to restore this as a different database, you need to know the file names because it will try to put the same files in the same place. So if you run the following:
EXEC dbname.dbo.sp_helpfile;
You should see output that contains the names and paths of the data and log files. When you construct your restore, you'll need to use these, but replace the paths with the name of the new database, e.g.:
RESTORE DATABASE newname FROM DISK = 'C\some folder\dbname.bak'
WITH MOVE 'dbname' TO 'C:\path_from_sp_helpfile_output\newname_data.mdf',
MOVE 'dbname_log' TO 'C:\path_from_sp_helpfile_output\newname_log.ldf';
You'll have to replace dbname and newname with your actual database names, and also some folder and C:\path_from_sp_helpfile_output\ with your actual paths. I can't get more specific in my answer unless I know what those are.
** EDIT **
Here is a full repro, which works completely fine for me:
CREATE DATABASE [DB-A];
GO
EXEC [DB-A].dbo.sp_helpfile;
Partial results:
name fileid filename
-------- ------ ---------------------------------
DB-A 1 C:\Program Files\...\DB-A.mdf
DB-A_log 2 C:\Program Files\...\DB-A_log.ldf
Now I run the backup:
BACKUP DATABASE [DB-A] TO DISK = 'C:\dev\DB-A.bak' WITH INIT;
Of course if the clone target (in this case DB-B) already exists, you'll want to drop it:
USE [master];
GO
IF DB_ID('DB-B') IS NOT NULL
BEGIN
ALTER DATABASE [DB-B] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [DB-B];
END
GO
Now this restore will run successfully:
RESTORE DATABASE [DB-B] FROM DISK = 'C:\dev\DB-A.bak'
WITH MOVE 'DB-A' TO 'C:\Program Files\...\DB-B.mdf',
MOVE 'DB-A_log' TO 'C:\Program Files\...\DB-B_log.ldf';
If you are getting errors about the contents of the BAK file, then I suggest you validate that you really are generating a new file and that you are pointing to the right file in your RESTORE command. Please try the above and let me know if it works, and try to pinpoint any part of the process that you're doing differently.
I realize this is an old question, but I was facing the same problem and I found that the UI was easier and faster than creating scripts to do this.
I believe Dan's problem was that he created the new database first and then tried to restore another database into it. I tried this as well and got the same error. The trick is to not create the database first and name the database during the "Restore Database" process.
The following article is somewhat useful in guiding you through the process:
http://msdn.microsoft.com/en-us/library/ms186390(v=sql.105).aspx

WordPress Plugins Development: How to initialize database when Plugin insalled/activated, and delete database when Plugin deactivated/deleted

I have a question:
How to initialize database when Plugin insalled/activated,
and delete database when Plugin deactivated/deleted.
The platform is PHP+MySQL on WAMP.
Can ANYONE help me?
Really Appreciate!
Crete MySQL table while installing plugin
Simply execute your MySQL create query in your plugin main file.While executing create query simply check this table is already exist or not.
Drop Mysql table while uninstalling plugin
Use register_uninstall_hook function(To answer this part of question Rarst helped me ).
More details here

Resources