61 lines
3.7 KiB
Markdown
61 lines
3.7 KiB
Markdown
# Database setup (2014)
|
|
|
|
Creates the four databases the 2014 servers use, with the original names:
|
|
|
|
| Database | Used by |
|
|
|---|---|
|
|
| `LosaGame` | game data and accounts (DB agent `ls_dbagent_game`) |
|
|
| `LosaGame_log` | logs written by procedures in `LosaGame` |
|
|
| `LosaLogData` | log server (DB agent `ls_dbagent_log`); only procedures, the log queries are stubs |
|
|
| `Backup` | stays empty: `game_region_backup_point` / `game_region_backup_compen` create their own tables in it |
|
|
|
|
This is the set used by the tested local setup (2026-11-07: nine servers, three accounts reach the lobby and the headquarters tutorial).
|
|
|
|
## Expected messages
|
|
|
|
Tested on SQL Server 2022 Express. Every script runs clean except two that come from the May 2012 base scripts:
|
|
|
|
- `04_LosaGame_procs.sql`: 153 "Invalid column name" messages = 22 old procedures written for newer tables. None of them is called by the 2014 servers.
|
|
- `05_LosaGame_etc.sql`: one old view (`userMannerpointDB`) fails the same way.
|
|
|
|
`LosaGame_log` comes from the 2021 release (the 2014 release has no script for it). 8 of the 23 log tables the old 2012 procedures write exist there; the other 15 belong to the old publisher web site (real-name check, recommend events, parent consent). 33 procedures use them and none is called by the servers (`ls_query.ini`), so nothing in game is affected.
|
|
|
|
## Needs
|
|
|
|
- SQL Server 2019 or newer (Express is enough) with **SQL Server and Windows authentication** (mixed mode).
|
|
- `sqlcmd` on PATH.
|
|
- Recommended: instance collation `Korean_Wansung_CI_AS`, like the original service.
|
|
|
|
## Setup
|
|
|
|
```bat
|
|
setup-db.bat .\SQLEXPRESS
|
|
```
|
|
|
|
It asks for the **DB agent password** (SQL login `lstggame`, used by both DB agents) and the **encode key** (15 characters, stored as the second key row; the login key tool must use the same value). Logs go to `logs\`.
|
|
|
|
**The 2014 DB agents expect the password encoded**: run `ls_dbagent.exe -x <password>` and put its output in `PW=` of both `ls_dbagent.ini` files. A disabled login `lstgweb` is also created only because the 2012 script creates a user for it.
|
|
|
|
| Script | Does |
|
|
|---|---|
|
|
| `00_create_databases.sql` | creates `LosaGame`, `LosaGame_log`, `LosaLogData`, `Backup` |
|
|
| `01_logins.sql` | SQL login `lstggame` (and the disabled `lstgweb`) |
|
|
| `02_LosaGame_log.sql` | `LosaGame_log` tables from the 2021 release |
|
|
| `03`-`05` | the 2014 release's `src\sql\20120504` scripts (tables, procedures, functions), UTF-8 |
|
|
| `06_LosaGame_stubs.sql`, `07_LosaLogData_stubs.sql` | empty stand-in procedures for the queries in `ls_query.ini` the 2012 scripts do not have (about 175 in LosaGame); replace one with a real procedure to make that feature work |
|
|
| `08_fixes_and_accounts.sql` | 64-bit server ID, the encode key, test accounts `test1`, `test2`, `gmtest1`, the login-key helper |
|
|
| `09_param_fixes.sql` | procedures whose 2012 parameter list is shorter than what the 2014 server sends |
|
|
| `10_features_from_2021.sql`, `12_core_procs_from_2021.sql` | columns, tables and procedures from the 2021 release that 2014 features need (pets, faction, costumes, ...) |
|
|
| `11_first_tournament.sql` | the first tournament row |
|
|
| `13_users.sql` | `lstggame` becomes `db_owner` of all four databases |
|
|
| `optional\test-heroes.sql` | six permanent heroes for the test accounts (Savage Berserker first: the headquarters tutorial needs it) |
|
|
|
|
## Backup and restore
|
|
|
|
```bat
|
|
backup.bat D:\LosaBackup .\SQLEXPRESS
|
|
restore.bat 20261107_1400 D:\LosaBackup .\SQLEXPRESS
|
|
```
|
|
|
|
`backup.bat` writes `<database>_<yyyyMMdd_HHmm>.bak` for all four databases (online). `restore.bat` asks first and replaces all four: **stop every server before restoring**. It restores to the paths stored in the backup (same server); on another server use `RESTORE DATABASE ... WITH MOVE` by hand.
|