sqlite3
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
원격 셸에서 기기로 또는 호스트 머신에서 sqlite3
명령줄 프로그램을 사용하여 Android 애플리케이션에서 만든 SQLite 데이터베이스를 관리합니다. sqlite3
도구에는 테이블의 내용을 출력하는 .dump
, 기존 테이블의 SQL CREATE 문을 출력하는 .schema
와 같은 명령어가 포함되어 있습니다. 이 도구는 SQLite 명령어를 즉시 실행할 수 있는 기능도 제공합니다.
자세한 내용은 SQLite 문서를 참고하세요. 자세한 내용은 sqlite3
및 SQLite에서 지원하는 SQL 언어 사양을 참고하세요.
원격 셸에서 sqlite3
를 사용하려면 다음을 실행합니다.
- 다음 명령어를 입력하여 원격 셸을 시작합니다.
adb [-d|-e|-s {<serialNumber>}] shell
- 원격 셸에서 다음 명령어를 입력하여
sqlite3
도구를 시작합니다.
sqlite3
원하는 경우 탐색하려는 데이터베이스의 전체 경로를 지정할 수도 있습니다.
에뮬레이터/기기 인스턴스는 SQLite 데이터베이스를 /data/data/<package_name>/databases/
디렉터리에 저장합니다.
sqlite3
를 호출한 후 셸에서 명령어를 실행할 수 있습니다. 종료 후 adb 원격 셸로 돌아가려면 exit
를 입력하거나 Control+D를 누릅니다.
예:
$ adb -s emulator-5554 shell
# sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db
SQLite version 3.3.12
Enter ".help" for instructions
.... enter commands, then quit...
# sqlite> .exit
참고: /data/data
디렉터리 계층 구조 내에서 파일을 보려면 파일 시스템에 대한 루트 액세스 권한이 필요합니다.
셸이 아닌 로컬에서 sqlite3
를 사용하려면 기기에서 데이터베이스 파일을 가져와 sqlite3
를 시작합니다.
- 기기에서 호스트 머신으로 데이터베이스 파일을 복사합니다.
adb pull <database-file-on-device>
sqlite3
도구를 시작하고 데이터베이스 파일을 지정합니다.
sqlite3 <database-file-on-host>
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# sqlite3\n\nFrom a remote shell to your device or from your host machine, use the [`sqlite3`](https://www.sqlite.org/) command-line program to manage\nSQLite databases created by Android applications. The `sqlite3` tool includes many\nuseful commands, such as `.dump` to print out the contents of a table and\n`.schema` to print the SQL CREATE statement for an existing table. The tool also gives\nyou the ability to execute SQLite commands on the fly.\n\nRefer to the [SQLite\ndocumentation](https://sqlite.org/docs.html) for full details. For additional documentation, visit\n[`sqlite3`](https://sqlite.org/cli.html) and the\n[SQL language specification](https://sqlite.org/lang.html) supported\nby SQLite.\n\nTo use `sqlite3` from a remote shell:\n\n1. Enter a remote shell by entering the following command: \n\n ```\n adb [-d|-e|-s {\u003cserialNumber\u003e}] shell\n ```\n2. From the remote shell, start the `sqlite3` tool by entering the following command: \n\n ```\n sqlite3\n ```\n\n You can also optionally specify a full path to a database that you want to explore.\n Emulator/device instances store SQLite databases in the directory\n `/data/data/\u003cpackage_name\u003e/databases/`.\n3. Once you invoke `sqlite3`, you can issue commands in the shell. To exit and return to the adb remote shell, enter `exit` or press Control+D.\n\nFor example: \n\n```\n$ adb -s emulator-5554 shell\n# sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db\nSQLite version 3.3.12\nEnter \".help\" for instructions\n.... enter commands, then quit...\n# sqlite\u003e .exit\n```\n\n**Note:** You need root access to the file system to view files\nwithin the `/data/data` directory hierarchy.\n\nTo use `sqlite3` locally, instead of within a shell,\npull the database file from the device and start `sqlite3`:\n\n1. Copy a database file from your device to your host machine: \n\n ```\n adb pull \u003cdatabase-file-on-device\u003e\n ```\n2. Start the `sqlite3` tool, specifying the database file: \n\n ```\n sqlite3 \u003cdatabase-file-on-host\u003e\n ```"]]