- Joined
- Jan 29, 2005
- Messages
- 1,367
- Reaction score
- 80
need some help, just came back from a long slumber and got stup!d with setting up.
http://forum.ragezone.com/f460/centos-7-repack-cabal-server-1144251-new/
[CentOS 7 Repack] Full Cabal Server Installation + CentOS SQL (Database) [Updated]
just like the tittle says, how to access SSMS on CentOS 7 for me to be able to restore db's?
http://forum.ragezone.com/f460/centos-7-repack-cabal-server-1144251-new/
[CentOS 7 Repack] Full Cabal Server Installation + CentOS SQL (Database) [Updated]
just like the tittle says, how to access SSMS on CentOS 7 for me to be able to restore db's?
[/B]Database Restoration
1. Login to your installed database, right click on Database and select "New Query", then copy this:
and click "Run". It will create all databases you will require.Code:CREATE DATABASE Account; CREATE DATABASE Authentication; CREATE DATABASE CabalCash; CREATE DATABASE CabalGuild; CREATE DATABASE EventData; CREATE DATABASE NetcafeBilling; CREATE DATABASE Server01;
2. Once databases are created, and backups are uploaded to /var/opt/mssql/backup, right-click on database and follow these steps:
Step 1: "Account" database -> "Tasks" -> "Restore" -> "Database..."
Step 2: Select "Device" -> Click on 3 dots (in image marked as 2) -> Select "Add" -> Once window opens, click on "backup" and select Account.bak file -> Click "Ok"
[outcome will be like picture]
Step 3: Select "Options" (1) -> Tick "Overwrite the existing database (WITH REPLACE) (2). If you have "Take tail-log backup before restore" -> DESELECT IT. It has to be as show in the image below -> Click "Ok" and wait till database restores.
Now repeat the STEPS ABOVE for all databases until they are fully restored.
Old method for 2017 MSSQL - reported problems - NOT ADVISED TO USE IT:
Once you have done all points in Database Installation part, follow these simple to restore your database using PuTTy Terminal, which is simple copy-paste + enter.
1. Download required repository for SQLCMD:2. Run the following command to install it:Code:curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
3. Create a symlink using this command:Code:sudo yum install mssql-tools unixODBC-devel
4. Using the following line in PuTTy terminal, you will create a database and restore it at the same time, without the need to login to SSMS Management and create everything there, as show in this sample:Code:sudo ln -s /opt/mssql-tools/bin/* /usr/local/bin/
Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [[COLOR=#ff0000][B]Account[/B][/COLOR]] FROM DISK = N'/var/opt/mssql/backup/[COLOR=#ff0000][B]Account.bak[/B][/COLOR]' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Copy paste the following lines in the spoiler below to restore full database.
*Important: after each line, you will be prompted to input database password.
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [Account] FROM DISK = N'/var/opt/mssql/backup/Account.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [Authentication] FROM DISK = N'/var/opt/mssql/backup/Authentication.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [CabalCash] FROM DISK = N'/var/opt/mssql/backup/CabalCash.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [CabalGuild] FROM DISK = N'/var/opt/mssql/backup/CabalGuild.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [EventData] FROM DISK = N'/var/opt/mssql/backup/EventData.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [NetCafeBilling] FROM DISK = N'/var/opt/mssql/backup/NetCafeBilling.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Click Enter -> Input your database password -> Click Enter -> Done!Code:sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [Server01] FROM DISK = N'/var/opt/mssql/backup/Server01.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
Database Location and Commands:
Location: /var/opt/mssql
Backups: /var/opt/mssql/backup
Command to restart database:Code:systemctl restart mssql-server
P.S. SQL has its own cmd, but it is not adviseable for novice user to use it, as SSMS does everything you need.
- How to change default database username to my own?
# Useful Tips #
Answer: Login to your Database -> Select "Security" (below "Databases") -> right-click user "sa" -> click "Rename" -> change it to whatever you like and hit "Enter" on your keyboard -> Done!
- How to change MSSQL default port (1433) into my custom one?
Answer:
- Firstly, add it into your firewall zone. If you will not add it before hand, you will block yourself out of the database.
- Then, run the following command in SSH terminal:
- After that you will be prompted to restart MSSQL Server, so use the following:Code:/opt/mssql/bin/mssql-conf set network.tcpport YOUR_PORT_HERE
Code:systemctl restart mssql-server.service
[/SPOILER]
[/CENTER]