Q: How to modify maximum page of database externally? I tried to modify the maximum page of a database externally.    
The code I  used was
 sqlite3 database.sqlite 'PRAGMA main.max_page_count = 2147483646;'

It returns
 2147483646

However, when I open the database and check the maximum page by
PRAGMA main.max_page_count;

It returned 1073741823.
When I modify the maximum page in sqlite3 interface by
PRAGMA main.max_page_count = 2147483646;

The maximum page was modified successfully. What should I do to modify this externally?

A: The max_page_count setting is a runtime option that doesn't persist across connections to a database:
$ sqlite3 foo.db
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
sqlite> pragma max_page_count=600;
max_page_count
--------------
600           
sqlite> .quit
$ sqlite3 foo.db    
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
sqlite> pragma max_page_count;
max_page_count
--------------
1073741823    

If you look at the description of the database header you'll see there's no field for the maximum page count. Much like things like turning on foreign key support, you have to explicitly set a limit on every connection. Or you can compile a custom version with SQLITE_MAX_PAGE_COUNT defined to the value you want.
