copy tenant from one db to another - junit

is it possible to copy e.g. the junit-Tenant from DB1 to DB2 and if yes, how?
The thing is that I don't want to lose my testdata when I connect to another database (which currently has no junit-tenant initialized)
Thanks very much!

You can do that using Impex (but it might arise some errors) and you have to do passwords separately (AFAIK at least).
Also, hybris never delete fields in DB. You have to remove attributes from DB1 that might have been created in the past but are not part of the data model any more (thus not created on DB2).
Export (without passwords) :
System -> Tools -> Script Generator
Click on "Generate"
Copy the result content.
remove these fields from the script: [#password, encodedPassword, password, passwordAnswer,passwordEncoding,passwordQuestion] from the generated scrip
Go to System -> Tools -> Export
Choose mode (re)import relaxed
Paste the previously copied script
Click on save
Click on Run
When finished, download the target results (data + media zip files)
Export Passwords :
Go to System -> Tools -> Export
Choose mode (re)import strict
Paste the content of this :
-------------------------------------------------------
# used 'header validation mode' during script generation was: import_strict
"#% impex.setLocale( new Locale( ""en"" , """" ) );"
-------------------------------------------------------
---- Extension: core ---- Type: User ----
"#% impex.setTargetFile( ""User.csv"" );"
insert_update User;&Item;#password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true]
"#% impex.exportItems( ""User"" , false );"
---- Extension: core ---- Type: Customer ----
"#% impex.setTargetFile( ""Customer.csv"" );"
insert_update Customer;&Item;#password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true]
"#% impex.exportItems( ""Customer"" , false );"
---- Extension: core ---- Type: Employee ----
"#% impex.setTargetFile( ""Employee.csv"" );"
insert_update Employee;&Item;#password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true]
"#% impex.exportItems( ""Employee"" , false );"
Click on save
Click on Run
When finished, download the target result
Import (without passwords) :
Go to System -> Tools -> Import
Upload the data zip file in "import file"
Set local setting to "en" (or the one you used in the export scripts)
Set model to import relaxed
Set error mode to ignore
Click on Next
Upload the media zip file in "import media"
Click on start
Import Passwords :
Go to System -> Tools -> Import
Upload the data zip file in "import file"
Set local setting to "en" (or the one you used in the export scripts)
Set model to import strict
Set error mode to ignore
Click on start

Not without significant effort. There is no easy way.
Best you can do is always initialize your data from impex.

Related

How to prevent ERROR 2013 (HY000) using Aurora Serverless

When performing long-running queries on Aurora Serverless I have seen the following errors after a few minutes:
ERROR 1080 (08S01) Forcing close of thread
ERROR 2013 (HY000) Lost connection to MySQL server during query
The queries are using mysql LOAD DATA LOCAL INFILE to load large (multi-GB) data files into the database.
How can I avoid these errors?
To solve this, you can change the parameter group item net_write_timeout to a more suitable value. Here's instructions for completing the steps from the console:
Go to RDS Console
Click "Parameter Groups" in the left pane
Click "Create Parameter Group"
On the Parameter Group Details page, for Type, choose DB Cluster Parameter Group; then give it a name and description, and click "Create"
Click on the name of the parameter group you created in step 4
Search for "net_write_timeout"
Click on the checkbox next to the parameter and click "Edit Parameters"
Change the value to an integer between 1-31536000 for the number of seconds you want it to wait before timing out, and click "save changes"
Click on Databases in the left pane
Click on the database and click "modify"
Under Additional Configuration > Database Options > DB Cluster Parameter Group, select the parameter group you created in step 4, and click "Continue"
Select "Apply Immediately" and click "Modify Cluster"
Break up your large, multi-GB uploads into smaller chunks. Aurora works better (and faster) loading one hundred 10MB files at once rather than one 1GB file. Assuming your data is already in a loadable format:
Split the file into parts using split
split -n l/100 --additional-suffix="_small" big_file.txt
This results in 100 files like xaa_small xab_small, etc.
find files that match the split suffixes using find
files=$(find . -name 'x*_small')
loop through the files and load each in parallel
for file in $files; do
echo "load data local infile '$file' into table my_table;" |
mysql --defaults-file=/home/ubuntu/.my.cnf --defaults-group-suffix=test &
done

Search file names that contain a string

I have a module named flume and file names that include that module name, like flumeIndexController, flumePlugin etc. Now I've decided to rename the module to oozie so I want to have these files renamed to include new module's name like oozieIndexController, ooziePlugin.
How can I get a list of files than include the flume string (in file name) possibly using built-in search or through any other option?
Navigate | File... Ctrl + Shift + N using Default keymap.
You can narrow your search results (just specify parts of the path, e.g. /abc/ and it will show results in a folders that match such pattern/abbreviation). Alternatively -- just do a post-filtering by excluding unwanted results (see below).
This window has only 2 buttons -- one of which will display results in a more traditional and permanent "Search results" tool window (the one that you see when you do Find in Path and alike).

Having trouble exporting to text file

I am having some trouble exporting out to a file from VBA. Some things to be aware of are that JobDetail is a valid export SpecName and 2_JobDetail is a query that combines some info with stuff from other fields and tables. When I try to run I get the error like below on my DoCmd.TransferText method call. Advice? am I doing something wrong? code below.
Public Function exportJobDetailRecs(dateStr As String)
'Docmd.TransferText(acexport,specName,TableName, FileName,HasfieldNames,HTMLTableName)
DoCmd.TransferText acExport, _
"JobDetail", _
"2_JobDetail", _
"P:\Folder1\Folder2\Tracker\" + CStr(dateStr + "_OrderStatus_jobdets.txt")
exportJobDetailRecs = CStr(dateStr + "_OrderStatus_jobdets.txt")
End Function
Some questions people have asked:
Yes - Do you have full permission to write to the file (i.e. full permission to the folder as well as the text file if you are not creating it with code)
Yes - Check path (folder name with space/etc) for mistakes.
and I'm copying with Shift-Right click, then copy as Path, and adding a trailing \ manually
Yes - Have you try exporting manually and overwriting your existing spec and see if that works? If so, try runs the code again afterward
Yes - Have you confirmed JobDetail is an export spec instead of an import spec?
and manual exports work fine
3-50 - How many records does 2_JobDetail currently return?
Same - Try the export (temporarily) to "P:\Folder1\Folder2\Tracker\a.txt"
It doesn't care what folder (that exists) I point it to, it wont go
None - Also make sure that there are no punctuation marks in strDate
http://pastie.org/private/0kdf2wvkg1wug5physna for the function I use to make dateStr
I figured this out. It wanted me to create the destination files too, not just the directories before I could copy to it.
I ran into the same problem. Solution: I changed all the column names and it worked. Something about the column names MS Access didn't like. I named them f1, f2, f3...
I just ran into the same problem; I changed the encoding from 'Westeuropean (Windows)' to 'Unicode (UTF-8)' and that did the trick. The problem probably had to do with this invisible 'character' in one of the fieldnames: "observer".

entity createdatabase ldf log file name change default how to

Visual Web Developer. Entity data sources model. I have it creating the new database fine. Example
creates SAMPLE1.MDF and SAMPLE1.LDF
When I run my app, it creates another SAMPLE1_LOG.lDF file.
When I run createdatabase, is there a place I can specify the _LOG.ldf for the log file? SQL 2008 r2.
It messes up when I run the DeleteDatabase functions... 2 log files...
How come it does not create the file SAMPLE1_Log.ldf to start with, if that is what it is looking for...
Thank you for your time,
Frank
// database or initial catalog produce same results...
// strip the .mdf off of newfile and see what happens?
// nope. this did not do anything... still not create the ldf file correctly!!!
// sample1.mdf, sample1.ldf... but when run, it creates sample1_log.LDF...
newfile = newfile.Substring(0, newfile.Length - 4);
String mfile = "Initial Catalog=" + newfile + ";data source=";
String connectionString = FT_EntityDataSource.ConnectionManager.GetConnectionString().Replace("data source=", mfile);
// String mexclude = #"attachdbfilename=" + "|" + "DataDirectory" + "|" + #"\" + newfile + ";";
// nope. must have attach to create the file in the app_data, otherwise if goes to documents & setting, etc sqlexpress.
// connectionString = connectionString.Replace(mexclude, "");
Labeldebug2.Text = connectionString;
using (FTMAIN_DataEntities1 context = new FTMAIN_DataEntities1(connectionString))
{
// try
// {
if (context.DatabaseExists())
{
Buttoncreatedb.Enabled = false;
box.Checked = true;
boxcreatedate.Text = DateTime.Now.ToString();
Session["zusermdf"] = Session["zusermdfsave"];
return;
// Make sure the database instance is closed.
// context.DeleteDatabase();
// i have entire diff section for deletedatabase.. not here.
}
// View the database creation script.
// Labeldebug.Text = Labeldebug.Text + " script ==> " + context.CreateDatabaseScript().ToString().Trim();
// Console.WriteLine(context.CreateDatabaseScript());
// Create the new database instance based on the storage (SSDL) section
// of the .edmx file.
context.CreateDatabaseScript();
context.CreateDatabase();
}
took out all the try, catch so i can see anything that might happen...
==========================================================================
Rough code while working out the kinks..
connection string it creates
metadata=res://*/FT_EDS1.csdl|res://*/FT_EDS1.ssdl|res://*/FT_EDS1.msl;provider=System.Data.SqlClient;provider connection string="Initial Catalog=data_bac100;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\data_bac100.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"
in this example, the file to create is "data_bac100.mdf".
It creates the data_bac100.mdf and data_bac100.ldf
when I actually use this file and tables to run, it auto-creates data_bac100_log.LDF
1) was trying just not to create the ldf, so when the system runs, it just creates the single one off the bat...
2) the Initial Catalog, and/or Database keywords are ONLY added to the connection string to run the createdatabase().. the regular connection strings created in web config only have attachdbfilename stuff, and works fine.
I have 1 connection string for unlimited databases, with the main database in the web.config.. I use a initialize section based on the user roles, whether visitor, member, admin, anonymous, or not authenticated... which sets the database correctly with a expression builder, and function to parse the connection string with the correct values for the database to operate on. This all runs good.
The entity framework automatically generates the script. I have tried with and without the .mdf extensions, makes no difference... thought maybe there is a setup somewhere that holds naming conventions for ldf files...
Eventually all of this will be for naught when start trying to deploy where not using APP_Data folder anyways...
Here is an example of connection string created when running application
metadata=res://*/FT_EDS1.csdl|res://*/FT_EDS1.ssdl|res://*/FT_EDS1.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\TDSLLC_Data.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"
in this case, use the TDSLLCData.mdf file...
04/01/2012... followup...
Entity Framework
feature
Log files created by the ObjectContext.CreateDatabase method
change
When the CreateDatabase method is called either directly or by using Code First with the SqlClient provider and an AttachDBFilename value in the connection string, it creates a log file named filename_log.ldf instead of filename.ldf (where filename is the name of the file specified by the AttachDBFilename value).
impact.
This change improves debugging by providing a log file named according to SQL Server specifications. It should have no unexpected side effects.
http://msdn.microsoft.com/en-us/library/hh367887(v=vs.110).aspx
I am on a Windows XP with .net 4 (not .net 4.5)... will hunt some more.. but looks like a issue that cannot be changed.
4/1/2012, 4:30...
ok, more hunting and searching and some of the inconsistancies I have experienced with createdatabase and databaseexists... so .net 4.5 is supposed to add the _log.ldf, and not just .ldf files, so they must have addressed this for some reason....
found others with same issues, but different server....
MySQL has a connector for EF4, the current version is 6.3.5 and its main functionalities are working fine but it still has issues with a few methods, e.g.
•System.Data.Objects.ObjectContext.CreateDatabase()
•System.Data.Objects.ObjectContext.DatabaseExists()
which makes it difficult to fully use the model-first approach. It's possible by manually editing the MySQL script (available with the CreateDatabaseScript method). The MySQL team doesn't seem eager to solve those bugs, I'm not sure what the commitment level actually is from their part but it certainly is lower than it once was.
That being said, the same methods fail with SQL CE too (they are not implemented, and I don't see the MS team as likely to tackle that soon).
Ran out of space below... it just becomes a problem when create a database, and it does not create the _log.ldf file, but just the ldf file, then use the database, and it creates a _log.ldf file... now you have 2 ldf files.. one becomes invalid.. Then when done with the database, delete it, then try to create a new, and a ldf exists, it will not work....
it turns out this is just the way it is with EF4, and they changed with EF4.5 beta to create the _log.ldf file to match what is created when the database is used.
thanks for time.
I've never used this "mdf attachment" feature myself and I don't know much about it, but according to the xcopy deployment documentation, you should not create a log file yourself because it will be automatically created when you attach the mdf. The docs also mention naming and say that the new log filename ends in _log.ldf. In other words, this behaviour appears to be by design and you can't change it.
Perhaps a more important question is, why do you care what the log file is called? Does it actually cause any problems for your application? If so, you should give details of that problem and see if someone has a solution.

Docmd.TransferText question

b'h
i will be programmatically importing a text file into a table. i have saved the import steps. i will use this:
DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
to do the import.
this is what SpecificationName means:
Specification Name The specification name for the set of options that determines how a text file is imported, exported, or linked. For a fixed-width text file, you must either specify a specification name or use a schema.ini file, which should be stored in the same directory as the imported, linked, or exported text file.
i do need a specific specification; however i do not know how to specify one. when i manually imported a table, i did save the specifications for my import, however i do not know how to call this in the TransferText.
does anyone know how to specify SpecificationName ?
When you do the import manually, you can save the import options as a specification. You assign a name to the specification at the time you create it. In Access 2003, click the Advanced button on the Import Text Wizard. Then you will get a dialog for <filename> Import Specification; click the Save As button and assign a Specification Name ... for example "MySpec".
Use that name (in quotes) as the SpecificationName option for your DoCmd.TransferText command.