diff --git a/core/includes/database.inc b/core/includes/database.inc
index ff03885..044a09b 100644
--- a/core/includes/database.inc
+++ b/core/includes/database.inc
@@ -26,7 +26,7 @@
  * instead.
  *
  * Do not use this function for INSERT, UPDATE, or DELETE queries. Those should
- * be handled via db_insert(), db_update() and db_delete() respectively.
+ * be handled via \Drupal::database()->insert(), db_update() and db_delete() respectively.
  *
  * @param string|\Drupal\Core\Database\StatementInterface $query
  *   The prepared statement query to run. Although it will accept both named and
diff --git a/core/lib/Drupal/Core/Database/database.api.php b/core/lib/Drupal/Core/Database/database.api.php
index 07e4343..1a767b6 100644
--- a/core/lib/Drupal/Core/Database/database.api.php
+++ b/core/lib/Drupal/Core/Database/database.api.php
@@ -124,11 +124,11 @@
  * @section_insert INSERT, UPDATE, and DELETE queries
  * INSERT, UPDATE, and DELETE queries need special care in order to behave
  * consistently across databases; you should never use db_query() to run
- * an INSERT, UPDATE, or DELETE query. Instead, use functions db_insert(),
+ * an INSERT, UPDATE, or DELETE query. Instead, use functions \Drupal::database()->insert(),
  * db_update(), and db_delete() to obtain a base query on your table, and then
  * add dynamic conditions (as illustrated in @ref sec_dynamic above).
  *
- * As a note, db_insert() and similar functions are wrappers on connection
+ * As a note, \Drupal::database()->insert() and similar functions are wrappers on connection
  * object methods. In most classes, you should use dependency injection and the
  * database connection object instead of these wrappers; See @ref sec_connection
  * below for details.
@@ -140,7 +140,7 @@
  * You can execute it via:
  * @code
  * $fields = array('id' => 1, 'uid' => 2, 'path' => 'path', 'name' => 'Name');
- * db_insert('example')
+ * \Drupal::database()->insert('example')
  *   ->fields($fields)
  *   ->execute();
  * @endcode
@@ -162,7 +162,7 @@
  *   $txn = db_transaction();
  *
  *   try {
- *     $id = db_insert('example')
+ *     $id = \Drupal::database()->insert('example')
  *       ->fields(array(
  *         'field1' => 'mystring',
  *         'field2' => 5,
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index 5ee5af6..cd25bb2 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -938,7 +938,7 @@ function hook_ENTITY_TYPE_presave(Drupal\Core\Entity\EntityInterface $entity) {
  */
 function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
   // Insert the new entity into a fictional table of all entities.
-  db_insert('example_entity')
+    \Drupal::database()->insert('example_entity')
     ->fields(array(
       'type' => $entity->getEntityTypeId(),
       'id' => $entity->id(),
@@ -962,7 +962,7 @@ function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
  */
 function hook_ENTITY_TYPE_insert(Drupal\Core\Entity\EntityInterface $entity) {
   // Insert the new entity into a fictional table of this type of entity.
-  db_insert('example_entity')
+    \Drupal::database()->insert('example_entity')
     ->fields(array(
       'id' => $entity->id(),
       'created' => REQUEST_TIME,
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index a4937f7..b96e010 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -51,7 +51,7 @@
  *   'grant_update' => 0,
  *   'grant_delete' => 0,
  * );
- * db_insert('node_access')->fields($record)->execute();
+ * \Drupal::database()->insert('node_access')->fields($record)->execute();
  * @endcode
  * And then in its hook_node_grants() implementation, it would need to return:
  * @code
diff --git a/core/modules/node/node.install b/core/modules/node/node.install
index 0582459..494faab 100644
--- a/core/modules/node/node.install
+++ b/core/modules/node/node.install
@@ -134,7 +134,7 @@ function node_install() {
   }
 
   // Populate the node access table.
-  db_insert('node_access')
+  \Drupal::database()->insert('node_access')
     ->fields(array(
       'nid' => 0,
       'gid' => 0,
diff --git a/core/modules/path/path.api.php b/core/modules/path/path.api.php
index 04e1fb3..15b639f 100644
--- a/core/modules/path/path.api.php
+++ b/core/modules/path/path.api.php
@@ -20,7 +20,7 @@
  * @see \Drupal\Core\Path\PathInterface::save()
  */
 function hook_path_insert($path) {
-  db_insert('mytable')
+  \Drupal::database()->insert('mytable')
     ->fields(array(
       'alias' => $path['alias'],
       'pid' => $path['pid'],
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index c36aa44..b690351 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -522,7 +522,7 @@ function search_index($type, $sid, $langcode, $text) {
   search_index_clear($type, $sid, $langcode);
 
   // Insert cleaned up data into dataset
-  db_insert('search_dataset')
+  \Drupal::database()->insert('search_dataset')
     ->fields(array(
       'sid' => $sid,
       'langcode' => $langcode,
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index 1b2f648..685a19b 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -69,7 +69,7 @@ function tracker_cron() {
         ->execute();
 
       // Insert the node-level data.
-      db_insert('tracker_node')
+      \Drupal::database()->insert('tracker_node')
         ->fields(array(
           'nid' => $nid,
           'published' => $node->isPublished(),
@@ -78,7 +78,7 @@ function tracker_cron() {
         ->execute();
 
       // Insert the user-level data for the node's author.
-      db_insert('tracker_user')
+      \Drupal::database()->insert('tracker_user')
         ->fields(array(
           'nid' => $nid,
           'published' => $node->isPublished(),
@@ -101,7 +101,7 @@ function tracker_cron() {
         ->groupBy('uid')
         ->execute();
       if ($result) {
-        $query = db_insert('tracker_user');
+        $query = \Drupal::database()->insert('tracker_user');
         foreach ($result as $row) {
           $query->fields(array(
             'uid' => $row['uid'],
diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php
index 2f40eb9..4df7d60 100644
--- a/core/modules/user/user.api.php
+++ b/core/modules/user/user.api.php
@@ -148,7 +148,7 @@ function hook_user_login($account) {
  *   The user object on which the operation was just performed.
  */
 function hook_user_logout($account) {
-  db_insert('logouts')
+  \Drupal::database()->insert('logouts')
     ->fields(array(
       'uid' => $account->id(),
       'time' => time(),
diff --git a/core/scripts/dump-database-d6.sh b/core/scripts/dump-database-d6.sh
index d0a89d7..4679a19 100644
--- a/core/scripts/dump-database-d6.sh
+++ b/core/scripts/dump-database-d6.sh
@@ -90,7 +90,7 @@
 
   // Dump the values if there are some.
   if ($insert) {
-    $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
+    $output .= "\Drupal::database()->insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
     $output .= $insert;
     $output .= "->execute();\n";
   }
diff --git a/core/scripts/dump-database-d7.sh b/core/scripts/dump-database-d7.sh
index 4689672..033b581 100644
--- a/core/scripts/dump-database-d7.sh
+++ b/core/scripts/dump-database-d7.sh
@@ -80,7 +80,7 @@
 
   // Dump the values if there are some.
   if ($insert) {
-    $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
+    $output .= "\Drupal::database()->insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
     $output .= $insert;
     $output .= "->execute();\n";
   }
diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh
index 8b591f4..4836b7c 100644
--- a/core/scripts/generate-d7-content.sh
+++ b/core/scripts/generate-d7-content.sh
@@ -45,7 +45,7 @@
 drupal_cron_run();
 
 // Create six users
-$query = db_insert('users')->fields(array('uid', 'name', 'pass', 'mail', 'status', 'created', 'access'));
+$query = \Drupal::database()->insert('users')->fields(array('uid', 'name', 'pass', 'mail', 'status', 'created', 'access'));
 for ($i = 0; $i < 6; $i++) {
   $name = "test user $i";
   $pass = md5("test PassW0rd $i !(.)");
